diff options
author | CaptainTK <CaptainTK@users.noreply.github.com> | 2017-10-03 16:59:17 +0200 |
---|---|---|
committer | learningit <scottyroscoe13@gmail.com> | 2017-10-03 10:59:17 -0400 |
commit | adcedb3fa65aad67838b3186d479c75cb8bfefb4 (patch) | |
tree | 33ae358e131f50cc14c026678c3a75a89c4c786f | |
parent | 3acc2fd687175d4768530f6983b9149566388217 (diff) |
[plugin.video.iplayerwww] 3.0.15 (#1442)
-rw-r--r-- | plugin.video.iplayerwww/addon.xml | 5 | ||||
-rw-r--r-- | plugin.video.iplayerwww/default.py | 3 | ||||
-rw-r--r-- | plugin.video.iplayerwww/resources/lib/ipwww_common.py | 6 | ||||
-rw-r--r-- | plugin.video.iplayerwww/resources/lib/ipwww_video.py | 93 |
4 files changed, 102 insertions, 5 deletions
diff --git a/plugin.video.iplayerwww/addon.xml b/plugin.video.iplayerwww/addon.xml index 3689026..02bda65 100644 --- a/plugin.video.iplayerwww/addon.xml +++ b/plugin.video.iplayerwww/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.iplayerwww" name="iPlayer WWW" version="3.0.14" provider-name="CaptainT, Cas, ihurst, primaeval"> +<addon id="plugin.video.iplayerwww" name="iPlayer WWW" version="3.0.15" provider-name="CaptainT, Cas, ihurst, primaeval"> <requires> <import addon="xbmc.python" version="2.25.0"/> <import addon="script.module.requests" version="2.7.0"/> @@ -22,6 +22,9 @@ <fanart>resources/fanart.jpg</fanart> </assets> <news> +v3.0.15 +Fixed Highlights. + v3.0.14 Fix for new mediator HTML. Live TV now uses a timestamp to avoid problems with "Hide watched". diff --git a/plugin.video.iplayerwww/default.py b/plugin.video.iplayerwww/default.py index 95264a8..c002c6c 100644 --- a/plugin.video.iplayerwww/default.py +++ b/plugin.video.iplayerwww/default.py @@ -120,6 +120,9 @@ elif mode == 105: elif mode == 106: Video.ListHighlights(url) +elif mode == 198: + Video.ListMainHighlights(url) + elif mode == 107: Video.ListWatching(logged_in) diff --git a/plugin.video.iplayerwww/resources/lib/ipwww_common.py b/plugin.video.iplayerwww/resources/lib/ipwww_common.py index 66eab30..797896f 100644 --- a/plugin.video.iplayerwww/resources/lib/ipwww_common.py +++ b/plugin.video.iplayerwww/resources/lib/ipwww_common.py @@ -36,7 +36,7 @@ addonid = "plugin.video.iplayerwww" addoninfo = GetAddonInfo() DIR_USERDATA = xbmc.translatePath(addoninfo["profile"]) cookie_jar = None -user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0' +user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0' headers = {'User-Agent': user_agent} @@ -447,7 +447,7 @@ def CreateBaseDirectory(content_type): if content_type == "video": ShowLicenceWarning() if ADDON.getSetting("menu_video_highlights") == 'true': - AddMenuEntry(translation(30300), 'iplayer', 106, + AddMenuEntry(translation(30300), 'iplayer', 198, xbmc.translatePath( 'special://home/addons/plugin.video.iplayerwww/media/top_rated.png' ), @@ -568,7 +568,7 @@ def CreateBaseDirectory(content_type): else: ShowLicenceWarning() if ADDON.getSetting("menu_video_highlights") == 'true': - AddMenuEntry((translation(30323)+translation(30300)), 'iplayer', 106, + AddMenuEntry((translation(30323)+translation(30300)), 'iplayer', 198, xbmc.translatePath( 'special://home/addons/plugin.video.iplayerwww/media/top_rated.png' ), diff --git a/plugin.video.iplayerwww/resources/lib/ipwww_video.py b/plugin.video.iplayerwww/resources/lib/ipwww_video.py index 96c6c5d..e7d17da 100644 --- a/plugin.video.iplayerwww/resources/lib/ipwww_video.py +++ b/plugin.video.iplayerwww/resources/lib/ipwww_video.py @@ -820,7 +820,7 @@ def ListHighlights(highlights_url): """Creates a list of the programmes in the highlights section. """ - html = OpenURL('http://www.bbc.co.uk/%s' % highlights_url) + html = OpenURL('https://www.bbc.co.uk/%s' % highlights_url) inner_anchors = re.findall(r'<a.*?(?!<a).*?</a>',html,flags=(re.DOTALL | re.MULTILINE)) @@ -1131,6 +1131,97 @@ def ListHighlights(highlights_url): xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED) +def ListMainHighlights(highlights_url): + """Creates a list of the programmes in the highlights section. + """ + + html = OpenURL('https://www.bbc.co.uk/%s' % highlights_url) + + outer_anchors = re.findall(r'<section class="section(?!<a).*?</section>', + html, flags=(re.DOTALL | re.MULTILINE)) + + for group in outer_anchors: + + group_type = '' + group_type_match = re.search( + r'data-section-type="(.*?)"', group, flags=(re.DOTALL | re.MULTILINE)) + if group_type_match: + group_type = group_type_match.group(1) + + # Skip trailers, we can't cope with them as of now. + if group_type == "trailers": + continue + + inner_anchors = re.findall(r'<a href="(?!<a).*?</a>', group, flags=(re.DOTALL | re.MULTILINE)) + + for programme in inner_anchors: + + is_group = False + button_match = re.search(r'button', programme, flags=(re.DOTALL | re.MULTILINE)) + if button_match: + is_group = True + + href = '' + href_match = re.match( + r'<a href="(.*?)"', programme, flags=(re.DOTALL | re.MULTILINE)) + if href_match: + href = href_match.group(1) + + name = '' + if group_type == "popular": + name_match = re.search( + r'<span class="typo.+?">(.*?)</span>', + programme, flags=(re.DOTALL | re.MULTILINE)) + else: + name_match = re.search( + r'item__title.+?<strong>(.*?)</strong>', + programme, flags=(re.DOTALL | re.MULTILINE)) + if name_match: + name = name_match.group(1) + + subtitle_match = re.search( + r'<p class=".+?subtitle.+?>(.*?)</p>', programme, flags=(re.DOTALL | re.MULTILINE)) + if subtitle_match: + name = name + ' - ' + subtitle_match.group(1) + + iconimage = '' + iconimage_match = re.search( + r'320x180/(.*?)\.jpg', programme, flags=(re.DOTALL | re.MULTILINE)) + if iconimage_match: + iconimage = "http://ichef.bbci.co.uk/images/ic/832x468/"+iconimage_match.group(1)+".jpg" + + description = '' + description_match = re.search( + r'<p class="overlay__text__inner.+?>(.*?)</p>', + programme, flags=(re.DOTALL | re.MULTILINE)) + if description_match: + description = description_match.group(1) + + # If this is a group, get the "View all" text. + if is_group == True: + name_match = re.search(r'label="(.*?)"', programme, flags=(re.DOTALL | re.MULTILINE)) + if name_match: + name = name_match.group(1) + + # We need to postprocess the URL to get categories right + if group_type == "category": + category = '' + category_match = re.search(r'categories/(.*?)/', href, flags=re.DOTALL) + if category_match: + AddMenuEntry('[B]%s: %s[/B]' % (translation(30314), name), + category_match.group(1), 125, '', '', '') + else: + AddMenuEntry('[B]%s: %s[/B]' % (translation(30314), name), + href, 128, '', '', '') + + else: + CheckAutoplay(name, href, iconimage, description, '') + + xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_TITLE) + xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE) + xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED) + + def ListMostPopular(): """Scrapes all episodes of the most popular page.""" ScrapeEpisodes("http://www.bbc.co.uk/iplayer/group/most-popular") |