diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 082f61f..6e6af95 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -894,10 +894,14 @@ def EpisodeDetail(title, url, thumb): key = AddRecentWatchList(title=title, url=url, summary=summary, thumb=thumb) ) ) - except Exception as e: Log('ERROR init.py>EpisodeDetail>Movie %s, %s' % (e.args, (title + ' - ' + title_s))) - pass + Log("ERROR: %s with key:%s returned %s" % (url,url_s,server_info)) + else: + pass + if Prefs["use_debug"]: + Log("Video will not be displayed as playback option !") + Log("ERROR: %s with key:%s returned %s" % (url,url_s,server_info)) except Exception as e: Log('ERROR init.py>EpisodeDetail>Movie %s, %s' % (e.args, (title + ' - ' + title_s))) pass @@ -1007,7 +1011,13 @@ def TvShowDetail(tvshow, title, url, servers_list_new, server_lab, summary, thum ) ) except: - pass + Log('ERROR init.py>TvShowDetail %s, %s' % (e.args, (title + ' - ' + title_s))) + Log("ERROR: %s with key:%s returned %s" % (url,url_s,server_info)) + else: + pass + if Prefs["use_debug"]: + Log("Video will not be displayed as playback option !") + Log("ERROR: %s with key:%s returned %s" % (url,url_s,server_info)) if isTimeoutApproaching(clientProd = Client.Product, item = E(url), client_id=client_id): Log("isTimeoutApproaching action") @@ -1888,10 +1898,7 @@ def isItemVidAvailable(isOpenLoad, data): if ourl != None: try: if isOpenLoad: - ol_id = common.getOpenloadID(url=ourl) - vidurl = None - if ol_id != None: - vidurl = Openload.openloadURLfromID(ol_id=ol_id) + vidurl = Openload.openload(url=ourl) if vidurl != None: http_res = fmovies.request(url=vidurl, output='responsecode', httpsskip=httpsskip) if http_res in fmovies.HTTP_GOOD_RESP_CODES: @@ -1906,7 +1913,7 @@ def isItemVidAvailable(isOpenLoad, data): Log('ERROR init.py>isItemVidAvailable %s, %s:' % (e.args,ourl)) Log(data) isVideoOnline = 'unknown' - + if Prefs["use_debug"]: Log("--- LinkChecker ---") Log("Url: %s" % (ourl)) diff --git a/Contents/Code/common.py b/Contents/Code/common.py index a38047b..fb5562e 100644 --- a/Contents/Code/common.py +++ b/Contents/Code/common.py @@ -1,9 +1,8 @@ import time, fmovies, base64, unicodedata, re -Openload = SharedCodeService.openload ################################################################################ TITLE = "FMoviesPlus" -VERSION = '0.11' # Release notation (x.y - where x is major and y is minor) +VERSION = '0.12' # Release notation (x.y - where x is major and y is minor) GITHUB_REPOSITORY = 'coder-alpha/FMoviesPlus.bundle' PREFIX = "/video/fmoviesplus" ################################################################################ @@ -192,24 +191,6 @@ def GetPageAsString(url, headers=None, timeout=15): pass return page_data_string - -#################################################################################################### -@route(PREFIX + "/getOpenloadID") -def getOpenloadID(url): - - ol_id = None - try: - Openload.openloadhdr['Referer'] = url - webpage = GetPageAsString(url=url, headers=Openload.openloadhdr) - - if 'File not found' in webpage or 'deleted by the owner' in webpage or 'Sorry!' in webpage: - return None - - ol_id = Openload.search_regex(']+id="[^"]+"[^>]*>([0-9]+)',webpage, 'openload ID') - except: - pass - - return ol_id #################################################################################################### @route(PREFIX + "/removeAccents") diff --git a/Contents/DefaultPrefs.json b/Contents/DefaultPrefs.json index fcd2123..fb1f30b 100644 --- a/Contents/DefaultPrefs.json +++ b/Contents/DefaultPrefs.json @@ -1 +1 @@ -[ { "id": "cache_expiry_time", "label": "Cache Expiry Time (in mins.)", "type": "text", "default": "60" }, { "id": "dont_fetch_more_info", "label": "No Extra Info. for Nav. Pages (Speeds Up Navigation)", "type": "bool", "default": "false" }, { "id": "use_web_proxy", "label": "Use SSL Web-Proxy", "type": "bool", "default": "false" }, { "id": "use_https_alt", "label": "Use Alternate SSL/TLS", "type": "bool", "default": "false" }, { "id": "use_linkchecker", "label": "Use LinkChecker for Videos", "type": "bool", "default": "false" }, { "id": "use_vibrant_emoji", "label": "Enable Vibrant Emoji Icons (Limited Clients Support)", "type": "bool", "default": "false" }, { "id": "use_debug", "label": "Enable Debug Mode", "type": "bool", "default": "false" } ] \ No newline at end of file +[ { "id": "cache_expiry_time", "label": "Cache Expiry Time (in mins.)", "type": "text", "default": "60" }, { "id": "dont_fetch_more_info", "label": "No Extra Info. for Nav. Pages (Speeds Up Navigation)", "type": "bool", "default": "false" }, { "id": "use_https_alt", "label": "Use Alternate SSL/TLS", "type": "bool", "default": "false" }, { "id": "use_web_proxy", "label": "Use SSL Web-Proxy", "type": "bool", "default": "false" }, { "id": "use_linkchecker", "label": "Use LinkChecker for Videos", "type": "bool", "default": "false" }, { "id": "use_vibrant_emoji", "label": "Enable Vibrant Emoji Icons (Limited Clients Support)", "type": "bool", "default": "false" }, { "id": "use_debug", "label": "Enable Debug Mode", "type": "bool", "default": "false" } ] \ No newline at end of file diff --git a/Contents/Services/Shared Code/constants.pys b/Contents/Services/Shared Code/constants.pys index 4f901b2..102f0fc 100644 --- a/Contents/Services/Shared Code/constants.pys +++ b/Contents/Services/Shared Code/constants.pys @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Declare constants for common use here. diff --git a/Contents/Services/Shared Code/openload.pys b/Contents/Services/Shared Code/openload.pys index 4eb0909..b6c4e2e 100644 --- a/Contents/Services/Shared Code/openload.pys +++ b/Contents/Services/Shared Code/openload.pys @@ -1,5 +1,8 @@ +#!/usr/bin/env python + import urllib2, re -import constants as Constants + +from __builtin__ import ord ######################################################################################################### # @@ -14,8 +17,10 @@ import constants as Constants # ######################################################################################################### +USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0" + openloadhdr = { - 'User-Agent': Constants.USER_AGENT, + 'User-Agent': USER_AGENT, 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'Accept-Encoding': 'none', @@ -30,11 +35,11 @@ def openload(url): webpage = res.read() if 'File not found' in webpage or 'deleted by the owner' in webpage or 'Sorry!' in webpage: + print 'File removed' return None - ol_id = search_regex(']+id="[^"]+"[^>]*>([0-9]+)',webpage, 'openload ID') + ol_id = search_regex(']+id="[^"]+"[^>]*>([0-9A-Za-z]+)',webpage, 'openload ID') - video_url = openloadURLfromID(ol_id=ol_id) return video_url @@ -44,25 +49,33 @@ def openload(url): def openloadURLfromID(ol_id): try: - first_two_chars = int(float(ol_id[0:][:2])) - urlcode = {} - num = 2 + first_char = int(ol_id[0]) + urlcode = [] + num = 1 while num < len(ol_id): - key = int(float(ol_id[num + 3:][:2])) - urlcode[key] = chr(int(float(ol_id[num:][:3])) - first_two_chars) + i = ord(ol_id[num]) + key = 0 + if i <= 90: + key = i - 65 + elif i >= 97: + key = 25 + i - 97 + urlcode.append((key, compat_chr(int(ol_id[num + 2:num + 5]) // int(ol_id[num + 1]) - first_char))) num += 5 - sorted(urlcode, key=lambda key: urlcode[key]) - - urllink = ''.join(['%s' % (value) for (key, value) in urlcode.items()]) + urllink = ''.join([value for _, value in sorted(urlcode, key=lambda x: x[0])]) video_url = 'https://openload.co/stream/' + urllink return video_url except Exception as e: - print ('ERROR openload.pys>openloadURLfromID: Args:%s Url:%s' % (e.args, url)) + print ('ERROR openload.pys>openloadURLfromID: Args:%s ol_id:%s' % (e.args, ol_id)) return None + +try: + compat_chr = unichr # Python 2 +except NameError: + compat_chr = chr def search_regex(pattern, string, name, default=None, fatal=True, flags=0, group=None): mobj = re.search(pattern, string, flags) @@ -79,6 +92,6 @@ def search_regex(pattern, string, name, default=None, fatal=True, flags=0, group return None def testOpenLoad(): - print openload('https://openload.co/embed/Q0ZlJq6OHIE/') + print openload('https://openload.co/embed/jcR8gjl6KoA/') #testOpenLoad() \ No newline at end of file diff --git a/Contents/Services/URL/FMovies/ServiceCode.pys b/Contents/Services/URL/FMovies/ServiceCode.pys index 8cc0491..d65365d 100644 --- a/Contents/Services/URL/FMovies/ServiceCode.pys +++ b/Contents/Services/URL/FMovies/ServiceCode.pys @@ -206,6 +206,8 @@ def PlayVideo(url, isOpenLoad=False, useRedirect=False, refUrl=None): try: if isOpenLoad: url = Openload.openload(url) + if url == None: + raise Ex.MediaNotAvailable except: raise Ex.MediaNotAvailable