Skip to content

Commit

Permalink
0.8.2 - fixed 403 errors caused by uncommon UA
Browse files Browse the repository at this point in the history
  • Loading branch information
s0faking committed Apr 11, 2018
1 parent daaed87 commit 073fb75
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.8.2
- fixed 403 errors caused by uncommon UA

0.8.1
- fixed issue #56: db entries for the addon now start with plugin://

Expand Down
5 changes: 3 additions & 2 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
pluginhandle = int(sys.argv[1])
basepath = settings.getAddonInfo('path')
translation = settings.getLocalizedString
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

#video playback
tvthekplayer = xbmc.Player()
Expand Down Expand Up @@ -224,8 +225,8 @@ def startPlaylist(player,playlist):
elif mode == 'playlist':
startPlaylist(tvthekplayer,playlist)
elif mode == 'play':
if 'playlist.m3u' in videourl:
videourl = "%s|User-Agent=Mozilla" % videourl
videourl = "%s|User-Agent=%s" % (videourl,userAgent)
debugLog(videourl,'Info')
play_item = xbmcgui.ListItem(path=videourl)
xbmcplugin.setResolvedUrl(pluginhandle, True, listitem=play_item)
listCallback(False,pluginhandle)
Expand Down
11 changes: 5 additions & 6 deletions resources/lib/htmlscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class htmlScraper(Scraper):
__urlTips = __urlBase + '/tips'
__urlTopics = __urlBase + '/topics'
__urlArchive = __urlBase + '/archive'
__uaString = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'


def __init__(self, xbmc, settings, pluginhandle, quality, protocol, delivery, defaultbanner, defaultbackdrop):
Expand Down Expand Up @@ -458,10 +457,10 @@ def getLiveStreams(self):
except RuntimeError:
inputstreamAdaptive = False

liveurls['ORF1'] = "http://apasfiisl.apa.at/ipad/orf1_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8|User-Agent=%s" % self.__uaString
liveurls['ORF2'] = "http://apasfiisl.apa.at/ipad/orf2_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8|User-Agent=%s" % self.__uaString
liveurls['ORF3'] = "http://apasfiisl.apa.at/ipad/orf3_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8|User-Agent=%s" % self.__uaString
liveurls['ORFS'] = "http://apasfiisl.apa.at/ipad/orfs_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8|User-Agent=%s" % self.__uaString
liveurls['ORF1'] = "http://apasfiisl.apa.at/ipad/orf1_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8"
liveurls['ORF2'] = "http://apasfiisl.apa.at/ipad/orf2_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8"
liveurls['ORF3'] = "http://apasfiisl.apa.at/ipad/orf3_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8"
liveurls['ORFS'] = "http://apasfiisl.apa.at/ipad/orfs_"+self.videoQuality.lower()+"/orf.sdp/playlist.m3u8"

channelnames = {}
channelnames['ORF1'] = "ORF 1"
Expand Down Expand Up @@ -519,7 +518,7 @@ def getLiveStreams(self):
if child_list_time == time_str and child_list_title != title:
if inputstreamAdaptive and child_restart:
contextMenuItems.append(('Restart', 'RunPlugin(plugin://%s/?mode=liveStreamRestart&link=%s)' % (xbmcaddon.Addon().getAddonInfo('id'), child_list_link)))
child_list_streaming_url = self.getLivestreamUrl(child_list_link,self.videoQuality) + "|User-Agent=%s" % self.__uaString
child_list_streaming_url = self.getLivestreamUrl(child_list_link,self.videoQuality)
child_list_final_title = "[%s] - %s (%s)" % (channelnames[program],child_list_title,child_list_time)

self.html2ListItem(child_list_final_title,banner,"",state,time,program,program,child_list_streaming_url,None,False, True,contextMenuItems)
Expand Down
3 changes: 1 addition & 2 deletions resources/lib/serviceapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class serviceAPI(Scraper):
__urlShows = 'profiles?limit=1000'
__urlTips = 'page/startpage/tips'
__urlTopics = 'topics/overview?limit=1000'
__uaString = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'


serviceAPIEpisode = 'episode/%s'
Expand Down Expand Up @@ -294,7 +293,7 @@ def getLiveStreams(self):
continue
# already playing
elif livestreamStart < time.localtime():
link = self.JSONStreamingURL(result.get('sources')) + '|User-Agent=%s' % self.__uaString
link = self.JSONStreamingURL(result.get('sources'))
if inputstreamAdaptive and result.get('restart'):
contextMenuItems.append(('Restart', 'RunPlugin(plugin://%s/?mode=liveStreamRestart&link=%s)' % (xbmcaddon.Addon().getAddonInfo('id'), result.get('id'))))
else:
Expand Down

0 comments on commit 073fb75

Please sign in to comment.