summaryrefslogtreecommitdiff
path: root/plugin.video.spurs-tv/resources/lib/new_stadium.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.video.spurs-tv/resources/lib/new_stadium.py')
-rw-r--r--plugin.video.spurs-tv/resources/lib/new_stadium.py13
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'])