Skip to content

Commit

Permalink
OpenLoad fixed yet again
Browse files Browse the repository at this point in the history
Fixes:
- OpenLoad playback for website changes
  • Loading branch information
coder-alpha committed Feb 25, 2017
1 parent 210ad46 commit 9f6c2bf
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 43 deletions.
23 changes: 15 additions & 8 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand All @@ -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))
Expand Down
21 changes: 1 addition & 20 deletions Contents/Code/common.py
Original file line number Diff line number Diff line change
@@ -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"
################################################################################
Expand Down Expand Up @@ -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('<span[^>]+id="[^"]+"[^>]*>([0-9]+)</span>',webpage, 'openload ID')
except:
pass

return ol_id

####################################################################################################
@route(PREFIX + "/removeAccents")
Expand Down
2 changes: 1 addition & 1 deletion Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
@@ -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" }]
[ { "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" }]
Expand Down
1 change: 1 addition & 0 deletions Contents/Services/Shared Code/constants.pys
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python

# Declare constants for common use here.

Expand Down
41 changes: 27 additions & 14 deletions Contents/Services/Shared Code/openload.pys
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env python

import urllib2, re
import constants as Constants

from __builtin__ import ord

#########################################################################################################
#
Expand All @@ -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',
Expand All @@ -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('<span[^>]+id="[^"]+"[^>]*>([0-9]+)</span>',webpage, 'openload ID')
ol_id = search_regex('<span[^>]+id="[^"]+"[^>]*>([0-9A-Za-z]+)</span>',webpage, 'openload ID')


video_url = openloadURLfromID(ol_id=ol_id)

return video_url
Expand All @@ -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)
Expand All @@ -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()
2 changes: 2 additions & 0 deletions Contents/Services/URL/FMovies/ServiceCode.pys
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9f6c2bf

Please sign in to comment.