diff options
author | LS80 <github@lee-smith.me.uk> | 2017-04-23 22:39:14 +0100 |
---|---|---|
committer | LS80 <github@lee-smith.me.uk> | 2017-04-23 22:46:54 +0100 |
commit | 5e6f4fcd5d8819ff36d3825302046d204619c839 (patch) | |
tree | 68047c32d2859b3a601c1f0c442b7f0be73a00c4 /plugin.video.spurs-tv/resources | |
parent | a1e11f9d27f446204c1f4d7f2cb38c1185c396a8 (diff) |
[plugin.video.spurs-tv] 2.14.0
Diffstat (limited to 'plugin.video.spurs-tv/resources')
-rw-r--r-- | plugin.video.spurs-tv/resources/lib/new_stadium.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugin.video.spurs-tv/resources/lib/new_stadium.py b/plugin.video.spurs-tv/resources/lib/new_stadium.py index 32b4ded..1534417 100644 --- a/plugin.video.spurs-tv/resources/lib/new_stadium.py +++ b/plugin.video.spurs-tv/resources/lib/new_stadium.py @@ -3,9 +3,10 @@ http://new-stadium.tottenhamhotspur.com ''' -from urlparse import urljoin +from urlparse import urljoin, urlparse import json import re +import os from collections import namedtuple from bs4 import BeautifulSoup as BS @@ -15,7 +16,7 @@ URL_ROOT = "http://new-stadium.tottenhamhotspur.com/" RE_EMBED = re.compile(r'kWidget\.embed\((.*)\)') -Video = namedtuple('Video', ['title', 'entry_id']) +Video = namedtuple('Video', ['title', 'id']) def get_soup(path): @@ -27,9 +28,9 @@ def get_soup(path): def get_cams(): '''Generator for live stadium cameras''' soup = get_soup("interact") - div = soup.find('div', {'data-player-id': 'player2'}) - for tab in json.loads(div['data-tabs']): - yield Video(title=tab['title'], entry_id=tab['entryId']) + for stream_num, iframe in enumerate(soup('iframe', 'video-class'), start=1): + yield Video(title='Live Stream {}'.format(stream_num), + id=os.path.basename(urlparse(iframe['src']).path)) def get_video_gallery(): @@ -38,4 +39,4 @@ def get_video_gallery(): for video in soup('div', 'video-new'): video_vars = json.loads(RE_EMBED.search(video.find(text=RE_EMBED)).group(1)) yield Video(title=video.find_next_sibling('p').get_text().strip(), - entry_id=video_vars['entry_id']) + id=video_vars['entry_id']) |