diff --git a/Contents/Code/common.py b/Contents/Code/common.py
index fab7d07..22a6375 100644
--- a/Contents/Code/common.py
+++ b/Contents/Code/common.py
@@ -1,6 +1,6 @@
################################################################################
TITLE = "FMoviesPlus"
-VERSION = '0.84' # Release notation (x.y - where x is major and y is minor)
+VERSION = '0.85' # Release notation (x.y - where x is major and y is minor)
TAG = ''
GITHUB_REPOSITORY = 'coder-alpha/FMoviesPlus.bundle'
PREFIX = "/video/fmoviesplus"
@@ -323,6 +323,8 @@
RECAPTCHA_IMAGE_PREFIX = "recaptcha_img_"
FMOVIES_AVAILABLE = None
+DO_NOT_MAKE_ADDITIONAL_REQUESTS = True
+USE_CAPTCHA_AI = False
DEV_DEBUG = True if 'dev' in TAG else False
@@ -940,41 +942,50 @@ def GetPageElements(url, headers=None, referer=None, timeout=15):
return page_data_elems, error
####################################################################################################
-def make_cookie_str():
+def make_cookie_str(p_cookie=''):
try:
cookie_str = ''
- p_cookie = ''
error = ''
- if len(CACHE_COOKIE) > 0:
- user_defined_reqkey_cookie = None
- try:
- user_defined_reqkey_cookie = Prefs['reqkey_cookie']
- except:
- pass
- reqCookie = CACHE_COOKIE[0]['reqkey']
- if user_defined_reqkey_cookie != None and user_defined_reqkey_cookie != '':
- reqCookie = user_defined_reqkey_cookie
-
- p_cookie = CACHE_COOKIE[0]['cookie'] + '; ' + reqCookie
+ p_cookie_s = []
+ if p_cookie == '':
+ if len(CACHE_COOKIE) > 0:
+ user_defined_reqkey_cookie = None
+ try:
+ user_defined_reqkey_cookie = Prefs['reqkey_cookie']
+ except:
+ pass
+ reqCookie = CACHE_COOKIE[0]['reqkey']
+ if user_defined_reqkey_cookie != None and user_defined_reqkey_cookie != '':
+ reqCookie = user_defined_reqkey_cookie
+
+ p_cookie = CACHE_COOKIE[0]['cookie'] + '; ' + reqCookie
+ p_cookie = p_cookie.replace(';;',';')
+ p_cookie_s = p_cookie.split(';')
+ elif p_cookie != '':
+ p_cookie = p_cookie.replace(';;',';')
+ p_cookie_s = p_cookie.split(';')
+ else:
+ #setTokenCookie(serverts=serverts, use_debug=use_debug)
+ error = "Cookie not set ! Please try Reset Cookies under the Options menu."
+ p_cookie_s = []
+ else:
p_cookie = p_cookie.replace(';;',';')
p_cookie_s = p_cookie.split(';')
- cookie_string_arr = []
- else:
- #setTokenCookie(serverts=serverts, use_debug=use_debug)
- error = "Cookie not set ! Please try Reset Cookies under the Options menu."
- p_cookie_s = []
+
+ cookie_string_arr = []
for ps in p_cookie_s:
if '=' in ps:
try:
- ps_s = ps.split('=')
- k = ps_s[0].strip()
- v = ps_s[1].strip()
- if k == 'reqkey':
- if len(v) > 5:
+ if 'expires' not in ps.lower() and 'max-age' not in ps.lower() and 'path' not in ps:
+ ps_s = ps.split('=')
+ k = ps_s[0].strip()
+ v = ps_s[1].strip()
+ if k == 'reqkey':
+ if len(v) > 5:
+ cookie_string_arr.append(k+'='+v)
+ else:
cookie_string_arr.append(k+'='+v)
- else:
- cookie_string_arr.append(k+'='+v)
except:
pass
try:
@@ -1042,6 +1053,19 @@ def GetPageAsString(url, headers=None, timeout=15, referer=None):
else:
Log.Error(error)
Log(cookies)
+ elif USE_COOKIES and ('9anime' in url):
+ cookies, error = make_cookie_str()
+ if error == '':
+ headers['Cookie'] = cookies
+ headers['User-Agent'] = CACHE_COOKIE[0]['UA']
+
+ if use_debug:
+ Log("Using Cookie retrieved at: %s" % time.ctime(CACHE_COOKIE[0]['ts']))
+ Log("Using Cookie: %s" % (cookies))
+ else:
+ Log.Error(error)
+ Log(cookies)
+
try:
if Prefs["use_https_alt"]:
if use_debug:
@@ -1395,7 +1419,7 @@ def SplitImageIntoChoices(filename, fil_dir):
c += 1
else:
prog = ""
-
+
try:
prog_t = Prefs["imagemagick_dir_path"]
if prog_t != None:
@@ -1414,16 +1438,34 @@ def SplitImageIntoChoices(filename, fil_dir):
wh = min(w,h)
cmd = "-crop"
c = 0
+
for y in range(3):
for x in range(3):
params = "%sx%s+%s+%s" % (w,h,x*wh,y*wh)
- file_cmd = [Core.storage.join_path(prog, 'convert'), Core.storage.join_path(fil_dir, filename), cmd, params, Core.storage.join_path(fil_dir, '%s%s.jpg' % (RECAPTCHA_IMAGE_PREFIX,c))]
+ dest_file = '%s%s.jpg' % (RECAPTCHA_IMAGE_PREFIX,c)
+ file_cmd = [Core.storage.join_path(prog, 'convert'), Core.storage.join_path(fil_dir, filename), cmd, params, Core.storage.join_path(fil_dir, dest_file)]
process = subprocess.Popen(file_cmd, shell=False, cwd=fil_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ret = process.wait()
output = process.stdout.read()
- c += 1
+
if Prefs["use_debug"]:
Log('%s - %s' % (file_cmd, output))
+
+ if USE_CAPTCHA_AI == True:
+ c2 = 0
+ for j in range(2):
+ for k in range(2):
+ w1 = w/2
+ h1 = w/2
+ wh1 = min(w1,h1)
+ params2 = "%sx%s+%s+%s" % (w1,h1,k*wh1,j*wh1)
+ file_cmd = [Core.storage.join_path(prog, 'convert'), Core.storage.join_path(fil_dir, dest_file), cmd, params2, Core.storage.join_path(fil_dir, '%s%s_%s.jpg' % (RECAPTCHA_IMAGE_PREFIX,c,c2))]
+ process = subprocess.Popen(file_cmd, shell=False, cwd=fil_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ ret = process.wait()
+ output = process.stdout.read()
+ c2 += 1
+ c += 1
+
except Exception as e:
raise e
time.sleep(1)
diff --git a/Contents/Code/downloadsmenu.py b/Contents/Code/downloadsmenu.py
index 066dad1..f58fc28 100644
--- a/Contents/Code/downloadsmenu.py
+++ b/Contents/Code/downloadsmenu.py
@@ -896,8 +896,13 @@ def AutoPilotDownloadThread2(item, sources):
#######################################################################################################
def AutoPilotDownloadThread3(item, s, fsBytes, fs):
+ imdbid = None
try:
- return AddToDownloadsList(title=item['short_title'] if item['type']=='show' else item['title'], purl=item['purl'], url=s['url'], durl=s['durl'], summary=item['summary'], thumb=item['thumb'], year=item['year'], quality=s['quality'], source=s['source'], source_meta={}, file_meta={}, type=item['type'], vidtype=item['vidtype'], resumable=s['resumeDownload'], sub_url=s['sub_url'], fsBytes=fsBytes, fs=fs, file_ext=s['file_ext'], mode=common.DOWNLOAD_MODE[0], section_path=item['section_path'], section_title=item['section_title'], section_key=item['section_key'], session=item['session'], admin=item['admin'], params=s['params'], riptype=s['rip'], season=item['season'], episode=item['episode'], provider=s['provider'], page_url=s['page_url'], seq=s['seq'], imdbid=item['imdbid'], xitem=item['xitem'], viaCode=True)
+ imdbid=item['imdbid']
+ except:
+ pass
+ try:
+ return AddToDownloadsList(title=item['short_title'] if item['type']=='show' else item['title'], purl=item['purl'], url=s['url'], durl=s['durl'], summary=item['summary'], thumb=item['thumb'], year=item['year'], quality=s['quality'], source=s['source'], source_meta={}, file_meta={}, type=item['type'], vidtype=item['vidtype'], resumable=s['resumeDownload'], sub_url=s['sub_url'], fsBytes=fsBytes, fs=fs, file_ext=s['file_ext'], mode=common.DOWNLOAD_MODE[0], section_path=item['section_path'], section_title=item['section_title'], section_key=item['section_key'], session=item['session'], admin=item['admin'], params=s['params'], riptype=s['rip'], season=item['season'], episode=item['episode'], provider=s['provider'], page_url=s['page_url'], seq=s['seq'], imdbid=imdbid, xitem=item['xitem'], viaCode=True)
except Exception as e:
err = '{}'.format(e)
Log.Error('ERROR: downloadsmenu.py > AutoPilotDownloadThread3: %s' % err)
diff --git a/Contents/Code/fmovies.py b/Contents/Code/fmovies.py
index 7044397..cb1a1b8 100644
--- a/Contents/Code/fmovies.py
+++ b/Contents/Code/fmovies.py
@@ -47,7 +47,8 @@
USE_PHANTOMJS2 = False
USE_DATAID = True
-newmarketgidstorage = 'MarketGidStorage=%7B%220%22%3A%7B%22svspr%22%3A%22%22%2C%22svsds%22%3A15%2C%22TejndEEDj%22%3A%22MTQ5MzIxMTc0OTQ0NDExMDAxNDc3NDE%3D%22%7D%2C%22C110014%22%3A%7B%22page%22%3A3%2C%22time%22%3A1493215038742%7D%2C%22C110025%22%3A%7B%22page%22%3A3%2C%22time%22%3A1493216772437%7D%2C%22C110023%22%3A%7B%22page%22%3A3%2C%22time%22%3A1493216771928%7D%7D'
+newmarketgidstorage = ''
+newmarketgidstorage2 = ';MarketGidStorage=%7B%220%22%3A%7B%22svspr%22%3A%22%22%2C%22svsds%22%3A15%2C%22TejndEEDj%22%3A%22MTQ5MzIxMTc0OTQ0NDExMDAxNDc3NDE%3D%22%7D%2C%22C110014%22%3A%7B%22page%22%3A3%2C%22time%22%3A1493215038742%7D%2C%22C110025%22%3A%7B%22page%22%3A3%2C%22time%22%3A1493216772437%7D%2C%22C110023%22%3A%7B%22page%22%3A3%2C%22time%22%3A1493216771928%7D%7D'
####################################################################################################
@@ -331,6 +332,7 @@ def setTokenCookie(serverts=None, use_debug=False, reset=False, dump=False, quie
Log("Retrieved Saved Video-Token-Key: %s" % E(token_key))
Log("=====================TOKEN END============================")
else:
+ UA = common.client.randomagent()
reqkey_cookie = ''
cookie1 = ''
cookie2 = ''
@@ -379,6 +381,12 @@ def setTokenCookie(serverts=None, use_debug=False, reset=False, dump=False, quie
except Exception as e:
Log.Error(e)
Log("=====================SELENIUM END============================")
+ elif 'Your IP has been blocked' in result:
+ common.FMOVIES_AVAILABLE = False
+ if dump or use_debug:
+ Log("=====================TOKEN START============================")
+ Log('RE-CAPTCHA COOKIE TOKEN USED/REQUIRED - IP BLOCKED')
+ Log("=====================TOKEN END============================")
else:
common.FMOVIES_AVAILABLE = True
ALL_JS = None
@@ -550,14 +558,27 @@ def setTokenCookie(serverts=None, use_debug=False, reset=False, dump=False, quie
Log(unpacked_code)
except Exception as e:
Log('ERROR fmovies.py>Token-fetch-1: %s' % e)
+
+ try:
+ if len(TOKEN_KEY) == 0:
+ token_key = common.interface.request_via_proxy_as_backup(TOKEN_KEY_PASTEBIN_URL, httpsskip=use_https_alt, hideurl=True)
+ if token_key !=None and token_key != '':
+ #cookie_dict.update({'token_key':token_key})
+ TOKEN_KEY.append(token_key)
+ except Exception as e:
+ Log('ERROR fmovies.py>Token-fetch-2: %s' % e)
- query = {'ts': serverts}
- tk = get_token(query)
- query.update(tk)
+ query = {'ts': serverts, '_': '634'}
+ # tk = get_token(query)
+ # if tk != None:
+ # query.update(tk)
hash_url = urlparse.urljoin(BASE_URL, HASH_PATH_MENU)
hash_url = hash_url + '?' + urllib.urlencode(query)
- r1, headers, content, cookie2 = common.interface.request_via_proxy_as_backup(hash_url, headers=headersS, limit='0', output='extended', httpsskip=use_https_alt, hideurl=True)
+ r1, headers, content, cookie2 = common.interface.request_via_proxy_as_backup(hash_url, headers=headersS, limit='0', output='extended', httpsskip=use_https_alt, hideurl=False)
+ ck, er = common.make_cookie_str(cookie2)
+ if er == '' and ck != '' and 'NotFound' not in ck and '__cfduid' in ck and ck != cookie2:
+ cookie2 = ck
#Log(cookie2)
try:
if '__cfduid' in cookie2:
@@ -578,15 +599,6 @@ def setTokenCookie(serverts=None, use_debug=False, reset=False, dump=False, quie
except:
pass
- try:
- if len(TOKEN_KEY) == 0:
- token_key = common.interface.request_via_proxy_as_backup(TOKEN_KEY_PASTEBIN_URL, httpsskip=use_https_alt, hideurl=True)
- if token_key !=None and token_key != '':
- #cookie_dict.update({'token_key':token_key})
- TOKEN_KEY.append(token_key)
- except Exception as e:
- Log('ERROR fmovies.py>Token-fetch-2: %s' % e)
-
if len(TOKEN_KEY) > 0:
cookie_dict.update({'token_key':TOKEN_KEY[0]})
@@ -611,13 +623,17 @@ def setTokenCookie(serverts=None, use_debug=False, reset=False, dump=False, quie
try:
if len(cookie2) > 0:
- cookie = cookie1 + '; ' + cookie2 + '; user-info=null; ' + newmarketgidstorage
+ cookie = cookie1 + '; ' + cookie2 + newmarketgidstorage
else:
- cookie = cookie1 + '; user-info=null; ' + newmarketgidstorage
+ cookie = cookie1 + newmarketgidstorage
except Exception as e:
Log.Error(e)
- cookie = 'NotFound; %s; %s; user-info=null; %s' % (cookie1,cookie2,newmarketgidstorage)
-
+ cookie = 'NotFound; %s; %s%s' % (cookie1,cookie2,newmarketgidstorage)
+
+ ck, er = common.make_cookie_str(cookie)
+ if er == '' and ck != '' and 'NotFound' not in ck and '__cfduid' in ck and ck != cookie:
+ cookie = ck
+
cookie_dict.update({'ts':time.time(), 'cookie1': cookie1, 'cookie2': cookie2, 'cookie': cookie, 'UA': UA, 'reqkey':reqkey_cookie})
if dump or use_debug:
@@ -636,6 +652,15 @@ def setTokenCookie(serverts=None, use_debug=False, reset=False, dump=False, quie
del common.CACHE_COOKIE[:]
common.CACHE_COOKIE.append(cookie_dict)
+ ck, er = common.make_cookie_str()
+ if er == '' and ck != '' and 'NotFound' not in ck and '__cfduid' in ck and ck != cookie:
+ cookie = ck
+ cookie_dict.update({'cookie': cookie})
+ Dict['CACHE_COOKIE'] = E(JSON.StringFromObject(cookie_dict))
+ Dict.Save()
+ del common.CACHE_COOKIE[:]
+ common.CACHE_COOKIE.append(cookie_dict)
+
return cookie
def decodeAndParse(token, use_debug=False, use_https_alt=False, quiet=True):
@@ -1073,7 +1098,7 @@ def get_sources2(url, key, prev_error=None, use_debug=True, session=None, **kwar
ret_error = ''
Log(u'*PhantomJS* method is working: %s' % vx_url)
host_type = common.client.geturlhost(video_url)
- except:
+ except Exception as e:
raise Exception('phantomjs (fmovies.js) not working')
else:
raise Exception('phantomjs is disabled')
@@ -1153,8 +1178,14 @@ def get_servers(serverts, page_url, is9Anime=False, use_https_alt=False):
T_BASE_URL = BASE_URL
T_BASE_URL = 'https://%s' % common.client.geturlhost(page_url)
page_id = page_url.rsplit('.', 1)[1]
+ #https://fmovies.taxi/ajax/film/servers/woxzo?ts=1557154800&_=634
+ #https://fmovies.taxi/ajax/film/servers/v8vv?ts=1557248400&_=634
+ #https://fmovies.taxi/ajax/film/servers/0r5yr?ts=1557248400&_=634
server_query = '/ajax/film/servers/%s' % page_id
server_url = urlparse.urljoin(T_BASE_URL, server_query)
+ query = {'ts':serverts, '_': '634'}
+ server_url += '?' + urllib.urlencode(query)
+
#result = common.interface.request_via_proxy_as_backup(server_url, httpsskip=use_https_alt)
result, error = common.GetPageAsString(url=server_url, headers=None, referer=page_url)
html = '
%s
' % json.loads(result)['html'].replace('\n','').replace('\\','')
diff --git a/Contents/Code/main.py b/Contents/Code/main.py
index e82b0b9..5fe4a79 100644
--- a/Contents/Code/main.py
+++ b/Contents/Code/main.py
@@ -1552,7 +1552,6 @@ def IntHostTools(choice=None, myhost=None, mssg=None, session=None):
def IntProviderTools(choice=None, provider=None, mssg=None):
oc = ObjectContainer(title2='%s Tools' % provider.title())
-
if choice != None:
if choice == 'show_dump_log':
oc = ObjectContainer(title2='%s Log' % provider.title())
@@ -1722,8 +1721,6 @@ def ResetCookies(mode=None, **kwargs):
thumbIcon = R(common.ICON_NOTOK)
if lpl != None:
thumbIcon = R(Core.storage.join_path(common.RECAPTCHA_CACHE_DIR, '%s%s.jpg' % (common.RECAPTCHA_IMAGE_PREFIX,i)))
-
- Log(thumbIcon)
common.FMOVIES_CAPTCHA_SELECTION[str(i)] = bool
@@ -1806,6 +1803,7 @@ def SolveCaptchaFMovies(resp, **kwargs):
cookies += '; user-info=null; ' + fmovies.newmarketgidstorage
cookie_dict.update({'ts':time.time(), 'cookie':cookies, 'cookie1':cookies1, 'cookie2':'', 'UA': ua})
+ common.control.set_setting(common.control.RECEPTCHA_FMOVIES_COOKIE, cookie_dict)
Dict['CACHE_COOKIE'] = E(JSON.StringFromObject(cookie_dict))
Dict.Save()
@@ -1818,7 +1816,6 @@ def SolveCaptchaFMovies(resp, **kwargs):
del common.CACHE_COOKIE[:]
common.CACHE_COOKIE.append(cookie_dict)
-
common.FMOVIES_AVAILABLE = True
return MC.message_container('Success', 'Captch Solved !')
@@ -5370,7 +5367,12 @@ def MoviesWithTag(tags, session, is9anime='False', **kwargs):
@route(PREFIX + "/getmovieinfo")
def GetMovieInfo(summary, urlPath, referer=None, session=None, is9anime='False', **kwargs):
- if common.NO_MOVIE_INFO == True or urlPath == None and (summary == None or summary == '') or Prefs['use_web_proxy']:
+ if common.DO_NOT_MAKE_ADDITIONAL_REQUESTS == True:
+ if summary == None:
+ return 'Plot Summary on Item Page'
+ else:
+ return summary
+ elif common.NO_MOVIE_INFO == True or urlPath == None and (summary == None or summary == '') or Prefs['use_web_proxy']:
return 'Plot Summary on Item Page'
elif (is9anime == 'False' and common.UsingOption(common.DEVICE_OPTIONS[8], session=session) == True) or (is9anime == 'True' and common.UsingOption(common.DEVICE_OPTIONS[11], session=session) == True):
return 'Plot Summary on Item Page. Disabled via Device Options.'
@@ -5380,7 +5382,7 @@ def GetMovieInfo(summary, urlPath, referer=None, session=None, is9anime='False',
return summary
elif Prefs["dont_fetch_more_info"]:
return 'Plot Summary on Item Page'
-
+
try:
if is9anime == 'False':
url = urlparse.urljoin(fmovies.BASE_URL , urlPath)
diff --git a/Contents/Libraries/Shared/phantomjs/__init__.py b/Contents/Libraries/Shared/phantomjs/__init__.py
index 4f7d1b0..654aae0 100644
--- a/Contents/Libraries/Shared/phantomjs/__init__.py
+++ b/Contents/Libraries/Shared/phantomjs/__init__.py
@@ -103,6 +103,8 @@ def decode(url, python_dir=None, debug=False, ssl=True, js='openload.js', cookie
#print "2: %s" % output
output = output.strip().replace('\n','').encode('utf8').decode('ascii')
#print "3: %s" % output
+ if output != None and len(output) > 0 and '\r' in output:
+ output = output.split('\r')[0]
PROCESSES[url_encode].update({'Completed':True})
diff --git a/Contents/Libraries/Shared/phantomjs/fmoviesServers.js b/Contents/Libraries/Shared/phantomjs/fmoviesServers.js
new file mode 100644
index 0000000..cb1e134
--- /dev/null
+++ b/Contents/Libraries/Shared/phantomjs/fmoviesServers.js
@@ -0,0 +1,173 @@
+// Usage: phantomjs fmovies.js
+// if that doesn't work try: phantomjs --ssl-protocol=any fmovies.js
+// Author: Coder Alpha
+//
+
+var separator = ' | ';
+var page = require('webpage').create(),
+ system = require('system'),
+ id, match;
+
+if(system.args.length < 2) {
+ console.error('No URL provided');
+ phantom.exit(1);
+}
+
+function extractHostname(url) {
+ var hostname;
+ //find & remove protocol (http, ftp, etc.) and get hostname
+
+ if (url.indexOf("//") > -1) {
+ hostname = url.split('/')[2];
+ }
+ else {
+ hostname = url.split('/')[0];
+ }
+
+ //find & remove port number
+ hostname = hostname.split(':')[0];
+ //find & remove "?"
+ hostname = hostname.split('?')[0];
+
+ return hostname;
+}
+
+var page_url = system.args[1];
+var hostname = "."+extractHostname(page_url);
+
+if(system.args.length >= 2) {
+ if (system.args[2].indexOf(";") > -1) {
+ var cookies = system.args[2].split(";");
+
+ for (i=0; i < cookies.length; i++) {
+ if (cookies[i].indexOf("=") > -1) {
+ var cook = cookies[i].split("=");
+ var c_name = cook[0].trim();
+ var c_val = cook[1].trim();
+ phantom.addCookie({
+ 'name' : c_name, /* required property */
+ 'value' : c_val, /* required property */
+ 'domain' : hostname, /* required property */
+ 'path' : '/' /* required property */
+ });
+ }
+ }
+ }
+}
+
+page.settings.userAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36";
+if(system.args.length >= 3) {
+ if (system.args[3].indexOf("Mozilla") > -1) {
+ var ua = system.args[3];
+ page.settings.userAgent = ua;
+ }
+}
+
+// thanks @Mello-Yello :)
+page.onInitialized = function() {
+ page.evaluate(function() {
+ delete window._phantom;
+ delete window.callPhantom;
+ window.outerHeight = 1200;
+ window.outerWidth = 1600;
+ });
+ var MAXIMUM_EXECUTION_TIME = 2 * 60 * 1000; // 1 min. thanks @Zablon :)
+ setTimeout(function() {
+ phantom.exit();
+ }, MAXIMUM_EXECUTION_TIME);
+};
+
+// thanks @skidank (https://forums.plex.tv/discussion/comment/1582115/#Comment_1582115)
+page.onError = function(msg, trace) {
+ console.log(msg);
+ var info = page.evaluate(function() {
+ function GetIframeLink() {
+ try {
+ var elms = document.getElementById("servers-container").getElementsByTagName("div");
+ var txt = "";
+ for (var j = 0; j < elms.length; j++) {
+ var srctxt = elms[j].innerHTML;
+ if (srctxt != null && srctxt.length > 0) {
+ txt = txt + srctxt;
+ }
+ }
+ if (txt != null && txt.length > 0) {
+ return txt;
+ }
+ return null;
+ } catch(err) {
+ return 'Exception: ' + err.message + ', DocTitle:' + document.title;
+ }
+ };
+
+ var spanID = GetIframeLink();
+
+ if (spanID == null || spanID.length == 0 || spanID.indexOf('Exception') > -1) {
+ return {
+ decoded_id: spanID
+ };
+ }
+ return {
+ decoded_id: spanID
+ };
+ });
+
+ var myInfo = info.decoded_id;
+ if (myInfo == null || myInfo.length == 0 || myInfo.indexOf('Exception') > -1) {
+ console.log('ERROR: not found. ' + myInfo);
+ } else {
+ var url = info.decoded_id;
+ console.log(url);
+ }
+ phantom.exit();
+}
+
+page.open(page_url, function(status) {
+
+ //page.includeJs('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', function() {
+ var info = page.evaluate(function() {
+ function GetIframeLink() {
+ try {
+ var elms = document.getElementById("servers-container").getElementsByTagName("div");
+ var txt = "";
+ for (var j = 0; j < elms.length; j++) {
+ var srctxt = elms[j].innerHTML;
+ if (srctxt != null && srctxt.length > 0) {
+ txt = txt + srctxt;
+ }
+ }
+ if (txt != null && txt.length > 0) {
+ return txt;
+ }
+ return null;
+ } catch(err) {
+ return 'Exception: ' + err.message;
+ }
+ };
+
+ var spanID = GetIframeLink();
+
+ if (spanID == null || spanID.length == 0 || spanID.indexOf('Exception') > -1) {
+ return {
+ decoded_id: spanID
+ };
+ }
+ return {
+ decoded_id: spanID
+ };
+ });
+
+ var myInfo = info.decoded_id;
+ if (myInfo == null || myInfo.length == 0 || myInfo.indexOf('Exception') > -1) {
+ console.log('ERROR: Not found. ' + myInfo);
+ } else {
+ var url = info.decoded_id;
+ console.log(url);
+ }
+ //});
+});
+
+page.onLoadFinished = function(status) {
+ //console.log('Status: ' + status);
+ phantom.exit();
+};
\ No newline at end of file
diff --git a/Contents/Libraries/Shared/resources/lib/libraries/control.py b/Contents/Libraries/Shared/resources/lib/libraries/control.py
index 35640e0..cc151d8 100644
--- a/Contents/Libraries/Shared/resources/lib/libraries/control.py
+++ b/Contents/Libraries/Shared/resources/lib/libraries/control.py
@@ -42,6 +42,8 @@
Threads = []
ThreadBlockOper = [False]
+RECEPTCHA_FMOVIES_COOKIE = 'RECEPTCHA_FMOVIES_COOKIE'
+
partial_sources = []
ext_sources = []
diff --git a/Contents/Libraries/Shared/resources/lib/libraries/recaptcha_v2.py b/Contents/Libraries/Shared/resources/lib/libraries/recaptcha_v2.py
index 2bb0b3c..371a984 100644
--- a/Contents/Libraries/Shared/resources/lib/libraries/recaptcha_v2.py
+++ b/Contents/Libraries/Shared/resources/lib/libraries/recaptcha_v2.py
@@ -40,7 +40,7 @@ def __init__(self, *args, **kwargs):
self.captchaActive = False
self.cval = None
self.waf = "waf-verify"
- self.cookie = None
+ self.cookie = ''
self.ua = client.agent() #"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0"
self.headers = {'User-Agent':self.ua}
@@ -67,18 +67,36 @@ def formatCookie(self, cookie):
if '=' in c:
if 'expire' in c or 'httponly' in c.lower() or 'path' in c or 'domain' in c:
pass
+ elif 'max' in c.lower():
+ c = 'Max-Age=%s' % (60*60*24*365)
+ cookA.append(c.strip())
else:
cookA.append(c.strip())
cookA = list(set(cookA))
return '; '.join(x for x in cookA)
+ def pingWAF(self):
+ self.headers['Referer'] = self.baseUrl
+ self.headers['Cookie'] = self.cookie
+
+ log(type='INFO', method='pingWAF', err='%s' % urlparse.urljoin(self.baseUrl,self.waf), dolog=False, logToControl=False, doPrint=True)
+ r = client.request(urlparse.urljoin(self.baseUrl,self.waf), output='extended', headers=self.headers)
+ if isinstance(r, tuple) and len(r) == 4:
+ html, r2, r3, r4 = r
+ print "=======WAF======"
+ print r2, r3, r4
+ print "=======WAF======"
+
+ return
+
def getCookies(self):
self.headers['Referer'] = self.baseUrl
self.headers['Cookie'] = self.cookie
+ log(type='INFO', method='getCookies', err='%s' % urlparse.urljoin(self.baseUrl,self.ajax), dolog=True, logToControl=True, doPrint=True)
r = client.request(urlparse.urljoin(self.baseUrl,self.ajax), output='extended', headers=self.headers)
if isinstance(r, tuple) and len(r) == 4:
html, r2, r3, r4 = r
- #print r3, r4
+ #print r2, r3, r4
if 'Cookie' in r2.keys() and 'session' in r2['Cookie']:
self.cookie += '; ' + r2['Cookie']
@@ -100,21 +118,22 @@ def testSiteReq(self):
#print html[:200]
try:
- self.cookie = r4
- if self.cookie == None or len(self.cookie) == 0:
+ cookie = r4
+ if cookie == None or len(cookie) == 0:
try:
- self.cookie = re.findall(r'Set-Cookie:(.*?)\n', str(r3))[0].strip()
- self.cookie = self.formatCookie(self.cookie)
+ cookie = re.findall(r'Set-Cookie:(.*?)\n', str(r3))[0].strip()
+ cookie = self.formatCookie(cookie)
except:
pass
except:
pass
- e = "Retrieved cookie: %s" % self.cookie
+ e = "Retrieved cookie: %s" % cookie
log(type='INFO', method='testSiteReq', err='%s' % e, dolog=True, logToControl=True, doPrint=True)
self.captchaActive = False
if 'Please complete the security check to continue!' in html:
+ self.cookie = cookie
self.captchaActive = True
try:
self.sitekey = client.parseDOM(html, 'div', attrs={'class':'g-recaptcha'}, ret='data-sitekey')[0]
@@ -122,6 +141,8 @@ def testSiteReq(self):
e = 'Could not find data-sitekey'
log(type='ERROR', method='testSiteReq', err='%s' % e, dolog=True, logToControl=True, doPrint=True)
else:
+ if self.cookie == '' and len(cookie) > 0:
+ self.cookie = cookie
self.captchaActive = False
return html, r2, r3, r4
@@ -223,6 +244,7 @@ def solveCaptcha(self, resp, referer=None):
headers['Cookie'] = self.cookie
#print headers
+ log(type='INFO', method='solveCaptcha', err='%s' % urlparse.urljoin(self.baseUrl, self.waf), dolog=True, logToControl=True, doPrint=True)
r = client.request(urlparse.urljoin(self.baseUrl, self.waf).replace('https:','http:'), post=client.encodePostData(data), output='extended', headers=headers, followredirect=False, redirect=False)
if isinstance(r, tuple) and len(r) == 4:
html, r2, r3, r4 = r
diff --git a/Contents/Libraries/Shared/resources/lib/sources/fmovies_mv_tv.py b/Contents/Libraries/Shared/resources/lib/sources/fmovies_mv_tv.py
index 052cae7..32ccc3c 100644
--- a/Contents/Libraries/Shared/resources/lib/sources/fmovies_mv_tv.py
+++ b/Contents/Libraries/Shared/resources/lib/sources/fmovies_mv_tv.py
@@ -49,6 +49,7 @@
ENCRYPTED_URLS = False
USE_PHANTOMJS = True
+USE_TOKEN = False
class source:
def __init__(self):
@@ -77,6 +78,7 @@ def __init__(self):
self.ssl = False
self.name = name
self.captcha = False
+ self.blocked = False
self.use_selenium = False
self.headers = {}
self.cookie = None
@@ -149,12 +151,22 @@ def testSiteAlts(self, site):
self.captcha = False
except:
pass
+ try:
+ if 'Your Ip has been blocked' in content:
+ self.blocked = True
+ else:
+ self.blocked = False
+ except:
+ pass
if self.captcha == True:
log('INFO','testSiteAlts', 'Captcha is active - site will be set online but with captcha active. Sources will be available when captcha is inactive.')
+
+ if self.blocked == True:
+ log('INFO','testSiteAlts', 'You IP is blocked. Sources will be available when captcha is inactive.')
self.speedtest = time.time() - x1
- if self.captcha == True or 'Please complete the security check to continue!' in content:
+ if self.captcha == True or self.blocked == True:
if self.use_selenium == True and USE_SELENIUM == True:
self.captcha = True
cookies, content = seleniumca.getMyCookies(base_url=site)
@@ -171,7 +183,7 @@ def testSiteAlts(self, site):
log('INFO','testSiteAlts', 'cookie1: %s' % cookie1)
cookie2 = (';'.join('%s=%s' % (x['name'],x['value']) for x in my_cookies_via_sel))
log('INFO','testSiteAlts', 'cookie2: %s' % cookie2)
- cookie = '%s; %s; user-info=null; reqkey=%s' % (cookie1 , cookie2 , reqkey)
+ cookie = '%s; %s' % (cookie1 , cookie2)
self.headers['Cookie'] = cookie
log('SUCCESS', 'testSiteAlts', 'Cookies : %s for %s' % (cookie,self.base_link))
except Exception as e:
@@ -230,32 +242,30 @@ def initAndSleep(self):
#get cf cookie
if USE_SELENIUM == False or self.captcha == False or self.use_selenium == False:
cookie1 = proxies.request(url=t_base_link, headers=self.headers, output='cookie', use_web_proxy=self.proxyrequired, httpsskip=True)
+ cookie1 = make_cookie_str(cookie1)
self.headers['Cookie'] = cookie1
# get reqkey cookie
try:
- token_url = urlparse.urljoin(t_base_link, self.token_link)
- r1 = proxies.request(token_url, headers=self.headers, httpsskip=True)
- if r1 == None:
- raise Exception('%s not reachable !' % token_url)
- reqkey = self.decodeJSFCookie(r1)
+ if USE_TOKEN == True:
+ token_url = urlparse.urljoin(t_base_link, self.token_link)
+ r1 = proxies.request(token_url, headers=self.headers, httpsskip=True)
+ if r1 == None:
+ raise Exception('%s not reachable !' % token_url)
+ reqkey = self.decodeJSFCookie(r1)
except Exception as e:
reqkey = ''
log('FAIL','initAndSleep', 'Not using reqkey: %s' % e, dolog=False)
# get session cookie
serverts = str(((int(time.time())/3600)*3600))
- query = {'ts': serverts}
- try:
- tk = self.__get_token(query)
- except:
- tk = self.__get_token(query, True)
-
- query.update(tk)
+ query = {'ts': serverts, '_', '634'}
+
hash_url = urlparse.urljoin(t_base_link, self.hash_menu_link)
hash_url = hash_url + '?' + urllib.urlencode(query)
cookie2 = proxies.request(url=hash_url, headers=self.headers, output='cookie', httpsskip=True)
+ cookie2 = make_cookie_str(cookie2)
else:
log('INFO','initAndSleep', 'Attempting Selenium Retrieval - Start')
try:
@@ -272,7 +282,7 @@ def initAndSleep(self):
log('ERROR','initAndSleep', '%s' % e)
log('INFO','initAndSleep', 'Attempting Selenium Retrieval - End')
- cookie = '%s; %suser-info=null;%s' % (cookie1 , (';'+cookie2+' ') if len(cookie2)>0 else '' , ('reqkey=%s'%reqkey) if reqkey != '' else '')
+ cookie = '%s; %s' % (cookie1, cookie2)
self.headers['Cookie'] = cookie
log('SUCCESS', 'initAndSleep', 'Cookies : %s for %s' % (cookie,self.base_link))
except Exception as e:
@@ -551,7 +561,7 @@ def get_sources(self, url, hosthdDict=None, hostDict=None, locDict=None, proxy_o
quality = '480p'
riptype = 'BRRIP'
- result_servers = self.get_servers(url, proxy_options=proxy_options)
+ result_servers = self.get_servers(myts, url, proxy_options=proxy_options)
#print result_servers
servers_id = client.parseDOM(result_servers, 'div', attrs = {'class':'server row'}, ret='data-id')
#print servers_id
@@ -767,12 +777,14 @@ def resolve(self, url):
except:
return
- def get_servers(self, page_url, proxy_options=None):
+ def get_servers(self, serverts, page_url, proxy_options=None):
T_BASE_URL = self.base_link
T_BASE_URL = 'https://%s' % client.geturlhost(page_url)
page_id = page_url.rsplit('.', 1)[1]
server_query = '/ajax/film/servers/%s' % page_id
server_url = urlparse.urljoin(T_BASE_URL, server_query)
+ query = {'ts':serverts, '_': '634'}
+ server_url += '?' + urllib.urlencode(query)
log('INFO','get_servers', server_url, dolog=False)
result = proxies.request(server_url, headers=self.headers, referer=page_url, limit='0', proxy_options=proxy_options, use_web_proxy=self.proxyrequired, httpsskip=True)
html = '%s
' % json.loads(result)['html'].replace('\n','').replace('\\','')
@@ -968,6 +980,39 @@ def getVidToken(self):
self.TOKEN_KEY.append(token_key)
except Exception as e:
log('ERROR', 'getVidToken-2','%s' % e, dolog=False)
+
+####################################################################################################
+def make_cookie_str(p_cookie=''):
+ try:
+ cookie_str = ''
+ error = ''
+ p_cookie_s = []
+ cookie_string_arr = []
+
+ for ps in p_cookie_s:
+ if '=' in ps:
+ try:
+ if 'expires' not in ps.lower() and 'max-age' not in ps.lower() and 'path' not in ps:
+ ps_s = ps.split('=')
+ k = ps_s[0].strip()
+ v = ps_s[1].strip()
+ if k == 'reqkey':
+ if len(v) > 5:
+ cookie_string_arr.append(k+'='+v)
+ else:
+ cookie_string_arr.append(k+'='+v)
+ except:
+ pass
+ try:
+ cookie_str = ('; '.join(x for x in sorted(cookie_string_arr)))
+ except:
+ cookie_str = p_cookie
+
+ return cookie_str, error
+
+ except Exception as e:
+ log(type='ERROR', method='make_cookie_str', method='%s' % e)
+ return cookie_str, e
def log(type='INFO', method='undefined', err='', dolog=True, logToControl=False, doPrint=True):