Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin.video.iplayerwww] 4.0.17 #4423

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugin.video.iplayerwww/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.iplayerwww" name="iPlayer WWW" version="4.0.16" provider-name="CaptainT, Cas, ihurst, primaeval">
<addon id="plugin.video.iplayerwww" name="iPlayer WWW" version="4.0.17" provider-name="CaptainT, Cas, ihurst, primaeval">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.7.0"/>
Expand All @@ -22,8 +22,8 @@
<fanart>resources/fanart.jpg</fanart>
</assets>
<news>
v4.0.16
Live radio now needs an authentication token. Credits to dimkroon/kereltje once again.
v4.0.17
Live radio authentication token fixes and simplifications.

Known issues:
- No Red Button
Expand Down
3 changes: 3 additions & 0 deletions plugin.video.iplayerwww/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v4.0.17
Live radio authentication token fixes and simplifications.

v4.0.16
Live radio now needs an authentication token. Credits to dimkroon/kereltje once again.

Expand Down
201 changes: 102 additions & 99 deletions plugin.video.iplayerwww/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,150 +87,153 @@ def get_params():
except:
pass

# These are the modes which tell the plugin where to go.
if mode == 1:
Common.KidsMode()

elif mode is None or url is None or len(url) < 1:
Common.CreateBaseDirectory(content_type)
try:
# These are the modes which tell the plugin where to go.
if mode == 1:
Common.KidsMode()

# Modes 101-119 will create a main directory menu entry
elif mode == 101:
Video.ListLive()
elif mode is None or url is None or len(url) < 1:
Common.CreateBaseDirectory(content_type)

elif mode == 102:
Video.ListAtoZ()
# Modes 101-119 will create a main directory menu entry
elif mode == 101:
Video.ListLive()

elif mode == 103:
Video.ListCategories()
elif mode == 102:
Video.ListAtoZ()

elif mode == 104:
Video.Search(keyword)
elif mode == 103:
Video.ListCategories()

elif mode == 105:
Video.ListMostPopular()
elif mode == 104:
Video.Search(keyword)

elif mode == 106:
Video.ListHighlights(url)
elif mode == 105:
Video.ListMostPopular()

elif mode == 107:
Video.ListWatching()
elif mode == 106:
Video.ListHighlights(url)

elif mode == 108:
Video.ListFavourites()
elif mode == 107:
Video.ListWatching()

elif mode == 109:
Video.ListChannelHighlights()
elif mode == 108:
Video.ListFavourites()

elif mode == 112:
Radio.ListAtoZ()
elif mode == 109:
Video.ListChannelHighlights()

elif mode == 113:
Radio.ListLive()
elif mode == 112:
Radio.ListAtoZ()

elif mode == 114:
Radio.ListGenres()
elif mode == 113:
Radio.ListLive()

elif mode == 115:
Radio.Search(keyword)
elif mode == 114:
Radio.ListGenres()

elif mode == 116:
Radio.ListMostPopular()
elif mode == 115:
Radio.Search(keyword)

elif mode == 117:
Radio.ListListenList()
elif mode == 116:
Radio.ListMostPopular()

elif mode == 199:
Radio.ListFollowing()
elif mode == 117:
Radio.ListListenList()

elif mode == 118:
Video.RedButtonDialog()
elif mode == 199:
Radio.ListFollowing()

elif mode == 119:
Common.SignOutBBCiD()
elif mode == 118:
Video.RedButtonDialog()

elif mode == 120:
Video.ListChannelAtoZ()
elif mode == 119:
Common.SignOutBBCiD()

# Modes 121-199 will create a sub directory menu entry
elif mode == 121:
Video.GetEpisodes(url)
elif mode == 120:
Video.ListChannelAtoZ()

elif mode == 122:
Video.GetAvailableStreams(name, url, iconimage, description)
# Modes 121-199 will create a sub directory menu entry
elif mode == 121:
Video.GetEpisodes(url)

elif mode == 123:
Video.AddAvailableLiveStreamsDirectory(name, url, iconimage)
elif mode == 122:
Video.GetAvailableStreams(name, url, iconimage, description)

elif mode == 124:
Video.GetAtoZPage(url)
elif mode == 123:
Video.AddAvailableLiveStreamsDirectory(name, url, iconimage)

elif mode == 125:
Video.ListCategoryFilters(url)
elif mode == 124:
Video.GetAtoZPage(url)

elif mode == 126:
Video.GetFilteredCategory(url)
elif mode == 125:
Video.ListCategoryFilters(url)

elif mode == 127:
Video.GetGroup(url)
elif mode == 126:
Video.GetFilteredCategory(url)

elif mode == 128:
Video.ScrapeEpisodes(url)
elif mode == 127:
Video.GetGroup(url)

elif mode == 129:
Video.AddAvailableRedButtonDirectory(name, url)
elif mode == 128:
Video.ScrapeEpisodes(url)

elif mode == 131:
Radio.GetEpisodes(url)
elif mode == 129:
Video.AddAvailableRedButtonDirectory(name, url)

elif mode == 132:
Radio.GetAvailableStreams(name, url, iconimage, description)
elif mode == 131:
Radio.GetEpisodes(url)

elif mode == 133:
Radio.AddAvailableLiveStreamsDirectory(name, url, iconimage)
elif mode == 132:
Radio.GetAvailableStreams(name, url, iconimage, description)

elif mode == 134:
Video.ScrapeAtoZEpisodes(url)
elif mode == 133:
Radio.AddAvailableLiveStreamsDirectory(name, url, iconimage)

elif mode == 136:
Radio.GetPage(url)
elif mode == 134:
Video.ScrapeAtoZEpisodes(url)

elif mode == 137:
Radio.GetCategoryPage(url)
elif mode == 136:
Radio.GetPage(url)

elif mode == 138:
Radio.GetAtoZPage(url)
elif mode == 137:
Radio.GetCategoryPage(url)

elif mode == 139:
Video.ScrapeEpisodes(url)
elif mode == 138:
Radio.GetAtoZPage(url)

# Modes 201-299 will create a playable menu entry, not a directory
elif mode == 201:
Video.PlayStream(name, url, iconimage, description, subtitles_url)
elif mode == 139:
Video.ScrapeEpisodes(url)

elif mode == 202:
Video.AddAvailableStreamItem(name, url, iconimage, description)
# Modes 201-299 will create a playable menu entry, not a directory
elif mode == 201:
Video.PlayStream(name, url, iconimage, description, subtitles_url)

elif mode == 203:
Video.AddAvailableLiveStreamItemSelector(name, url, iconimage)
elif mode == 202:
Video.AddAvailableStreamItem(name, url, iconimage, description)

elif mode == 204:
Video.AddAvailableRedButtonItem(name, url)
elif mode == 203:
Video.AddAvailableLiveStreamItemSelector(name, url, iconimage)

elif mode == 205:
Video.AddAvailableUHDTrialItem(name, url)
elif mode == 204:
Video.AddAvailableRedButtonItem(name, url)

elif mode == 211:
Radio.PlayStream(name, url, iconimage, description, subtitles_url)
elif mode == 205:
Video.AddAvailableUHDTrialItem(name, url)

elif mode == 212:
Radio.AddAvailableStreamItem(name, url, iconimage, description)
elif mode == 211:
Radio.PlayStream(name, url, iconimage, description, subtitles_url)

elif mode == 213:
Radio.AddAvailableLiveStreamItem(name, url, iconimage)
elif mode == 212:
Radio.AddAvailableStreamItem(name, url, iconimage, description)

elif mode == 197:
Video.ListUHDTrial()
elif mode == 213:
Radio.AddAvailableLiveStreamItem(name, url, iconimage)

elif mode == 197:
Video.ListUHDTrial()
except Common.IpwwwError as err:
xbmcgui.Dialog().ok(Common.translation(30400), str(err))
sys.exit(1)

xbmcplugin.endOfDirectory(int(sys.argv[1]))
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ msgctxt "#30413"
msgid "Please check you installed this plugin correctly."
msgstr ""

msgctxt "#30414"
msgid "This BBC Sounds programme is available to play in the UK only."
msgstr ""

msgctxt "#30500"
msgid "Display"
msgstr ""
Expand Down Expand Up @@ -475,4 +479,3 @@ msgstr ""
msgctxt "#30529"
msgid "iPlayer: UHD Trial Channels"
msgstr ""

38 changes: 8 additions & 30 deletions plugin.video.iplayerwww/resources/lib/ipwww_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import html
import codecs
import time
import json

import xbmc
import xbmcvfs
Expand All @@ -28,6 +27,14 @@
ADDON = xbmcaddon.Addon(id='plugin.video.iplayerwww')


class IpwwwError(Exception):
pass


class GeoBlockedError(IpwwwError):
pass


def tp(path):
return xbmcvfs.translatePath(path)

Expand Down Expand Up @@ -395,35 +402,6 @@ def OpenURLPost(url, post_data):
return r


def GetJWT(url):
with requests.Session() as session:
session.cookies = cookie_jar
session.headers = headers
try:
r = session.get(url, allow_redirects=False)
except requests.exceptions.RequestException as e:
dialog = xbmcgui.Dialog()
dialog.ok(translation(30400), "%s" % e)
sys.exit(1)
try:
#Set ignore_discard to overcome issue of not having session
#as cookie_jar is reinitialised for each action.
# Refreshed token cookies are set on intermediate requests.
# Only save if there have been any.
if r.history:
cookie_jar.save(ignore_discard=True)
if r.text:
match = re.search(r'<script> window.__PRELOADED_STATE__ = (.*?);\s*</script>', r.text, re.DOTALL)
if match:
json_data = json.loads(match[1])
if 'smp' in json_data:
if 'liveStreamJwt' in json_data['smp']:
return json_data['smp']['liveStreamJwt']
except:
pass
return None


def GetCookieJar():
return cookie_jar

Expand Down
Loading
Loading