Fix alternativo a redirect
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@
|
|||||||
"raiplay": "https://www.raiplay.it",
|
"raiplay": "https://www.raiplay.it",
|
||||||
"serietvu": "https://www.serietvu.live",
|
"serietvu": "https://www.serietvu.live",
|
||||||
"streamingcommunity": "https://streamingcommunity.top",
|
"streamingcommunity": "https://streamingcommunity.top",
|
||||||
"streamingita": "https://eurostreaming.vote",
|
"streamingita": "https://www.streamingita.life",
|
||||||
"streamtime": "https://t.me/s/StreamTime",
|
"streamtime": "https://t.me/s/StreamTime",
|
||||||
"tantifilm": "https://www.tantifilm.zone",
|
"tantifilm": "https://www.tantifilm.zone",
|
||||||
"toonitalia": "https://toonitalia.co",
|
"toonitalia": "https://toonitalia.co",
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
host = support.config.get_channel_url()
|
host = support.config.get_channel_url()
|
||||||
session = requests.Session()
|
|
||||||
session.request = functools.partial(session.request, timeout=httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT)
|
|
||||||
headers = {}
|
headers = {}
|
||||||
|
|
||||||
|
|
||||||
@@ -28,10 +26,10 @@ def getHeaders(forced=False):
|
|||||||
if not headers:
|
if not headers:
|
||||||
# try:
|
# try:
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
|
||||||
response = session.get(host, headers=headers)
|
response = httptools.downloadpage(host, headers=headers)
|
||||||
# if not response.url.startswith(host):
|
# if not response.url.startswith(host):
|
||||||
# host = support.config.get_channel_url(findhost, forceFindhost=True)
|
# host = support.config.get_channel_url(findhost, forceFindhost=True)
|
||||||
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
csrf_token = support.match(response.data, patron='name="csrf-token" content="([^"]+)"').match
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
|
||||||
'content-type': 'application/json;charset=UTF-8',
|
'content-type': 'application/json;charset=UTF-8',
|
||||||
'Referer': host,
|
'Referer': host,
|
||||||
@@ -92,10 +90,10 @@ def newest(category):
|
|||||||
item.args = 1
|
item.args = 1
|
||||||
item.newest = True
|
item.newest = True
|
||||||
if category == 'peliculas':
|
if category == 'peliculas':
|
||||||
item.contentType == 'movie'
|
item.contentType = 'movie'
|
||||||
item.url = host + '/film'
|
item.url = host + '/film'
|
||||||
else:
|
else:
|
||||||
item.contentType == 'tvshow'
|
item.contentType = 'tvshow'
|
||||||
item.url = host + '/serie-tv'
|
item.url = host + '/serie-tv'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -133,10 +131,10 @@ def peliculas(item):
|
|||||||
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)"\s*slider-name="').matches[item.args])
|
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)"\s*slider-name="').matches[item.args])
|
||||||
elif not item.search:
|
elif not item.search:
|
||||||
payload = json.dumps({'type': videoType, 'offset':offset, 'genre':item.args})
|
payload = json.dumps({'type': videoType, 'offset':offset, 'genre':item.args})
|
||||||
records = session.post(host + '/api/browse', headers=headers, data=payload).json()['records']
|
records = httptools.downloadpage(host + '/api/browse', headers=headers, post=payload).json['records']
|
||||||
else:
|
else:
|
||||||
payload = json.dumps({'q': item.search})
|
payload = json.dumps({'q': item.search})
|
||||||
records = session.post(host + '/api/search', headers=headers, data=payload).json()['records']
|
records = httptools.downloadpage(host + '/api/search', headers=headers, post=payload).json['records']
|
||||||
|
|
||||||
|
|
||||||
if records and type(records[0]) == list:
|
if records and type(records[0]) == list:
|
||||||
@@ -171,8 +169,8 @@ def peliculas(item):
|
|||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
def makeItem(n, it, item):
|
def makeItem(n, it, item):
|
||||||
info = session.post(host + '/api/titles/preview/{}'.format(it['id']), headers=headers).json()
|
info = httptools.downloadpage(host + '/api/titles/preview/{}'.format(it['id']), headers=headers, post={}).json
|
||||||
logger.debug(jsontools.dump(it))
|
logger.debug(it)
|
||||||
title = info['name']
|
title = info['name']
|
||||||
lang = 'Sub-ITA' if 'sub-ita' in title.lower() else 'ITA'
|
lang = 'Sub-ITA' if 'sub-ita' in title.lower() else 'ITA'
|
||||||
title = support.cleantitle(re.sub('\[|\]|[Ss][Uu][Bb]-[Ii][Tt][Aa]', '', title))
|
title = support.cleantitle(re.sub('\[|\]|[Ss][Uu][Bb]-[Ii][Tt][Aa]', '', title))
|
||||||
|
|||||||
+7
-1
@@ -375,8 +375,14 @@ def downloadpage(url, **opt):
|
|||||||
timeout=opt['timeout'])
|
timeout=opt['timeout'])
|
||||||
else:
|
else:
|
||||||
# Makes the request with POST method
|
# Makes the request with POST method
|
||||||
req = session.post(url, data=payload, allow_redirects=opt.get('follow_redirects', True),
|
req = session.post(url, data=payload, allow_redirects=False,
|
||||||
files=files, timeout=opt['timeout'])
|
files=files, timeout=opt['timeout'])
|
||||||
|
# Make sure it follows redirects
|
||||||
|
i = 10
|
||||||
|
while opt.get('follow_redirects', True) and i > 0 and req.status_code == 301:
|
||||||
|
req = session.post(req.headers['Location'], data=payload, allow_redirects=False,
|
||||||
|
files=files, timeout=opt['timeout'])
|
||||||
|
i -= 1
|
||||||
|
|
||||||
elif opt.get('only_headers', False):
|
elif opt.get('only_headers', False):
|
||||||
info_dict = fill_fields_pre(url, opt, proxy_data, file_name)
|
info_dict = fill_fields_pre(url, opt, proxy_data, file_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user