Fix alternativo a redirect
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
"raiplay": "https://www.raiplay.it",
|
||||
"serietvu": "https://www.serietvu.live",
|
||||
"streamingcommunity": "https://streamingcommunity.top",
|
||||
"streamingita": "https://eurostreaming.vote",
|
||||
"streamingita": "https://www.streamingita.life",
|
||||
"streamtime": "https://t.me/s/StreamTime",
|
||||
"tantifilm": "https://www.tantifilm.zone",
|
||||
"toonitalia": "https://toonitalia.co",
|
||||
|
||||
@@ -17,8 +17,6 @@ else:
|
||||
|
||||
|
||||
host = support.config.get_channel_url()
|
||||
session = requests.Session()
|
||||
session.request = functools.partial(session.request, timeout=httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT)
|
||||
headers = {}
|
||||
|
||||
|
||||
@@ -28,10 +26,10 @@ def getHeaders(forced=False):
|
||||
if not headers:
|
||||
# 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'}
|
||||
response = session.get(host, headers=headers)
|
||||
response = httptools.downloadpage(host, headers=headers)
|
||||
# if not response.url.startswith(host):
|
||||
# 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',
|
||||
'content-type': 'application/json;charset=UTF-8',
|
||||
'Referer': host,
|
||||
@@ -92,8 +90,10 @@ def newest(category):
|
||||
item.args = 1
|
||||
item.newest = True
|
||||
if category == 'peliculas':
|
||||
item.contentType = 'movie'
|
||||
item.url = host + '/film'
|
||||
else:
|
||||
item.contentType = 'tvshow'
|
||||
item.url = host + '/serie-tv'
|
||||
|
||||
try:
|
||||
@@ -131,10 +131,10 @@ def peliculas(item):
|
||||
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)"\s*slider-name="').matches[item.args])
|
||||
elif not item.search:
|
||||
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:
|
||||
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:
|
||||
@@ -169,8 +169,8 @@ def peliculas(item):
|
||||
return itemlist
|
||||
|
||||
def makeItem(n, it, item):
|
||||
info = session.post(host + '/api/titles/preview/{}'.format(it['id']), headers=headers).json()
|
||||
logger.debug(jsontools.dump(it))
|
||||
info = httptools.downloadpage(host + '/api/titles/preview/{}'.format(it['id']), headers=headers, post={}).json
|
||||
logger.debug(it)
|
||||
title = info['name']
|
||||
lang = 'Sub-ITA' if 'sub-ita' in title.lower() else 'ITA'
|
||||
title = support.cleantitle(re.sub('\[|\]|[Ss][Uu][Bb]-[Ii][Tt][Aa]', '', title))
|
||||
@@ -213,7 +213,7 @@ def episodios(item):
|
||||
season=episodes['number'],
|
||||
contentSeason=episodes['number'],
|
||||
contentEpisodeNumber=it['number'],
|
||||
thumbnail=it['images'][0]['original_url'] if 'images' in it and 'original_url' in it['images'][0] else item.thumbnail,
|
||||
thumbnail=it['images'][0].get('original_url', item.thumbnail) if it['images'] else item.thumbnail,
|
||||
contentThumbnail=item.thumbnail,
|
||||
fanart=item.fanart,
|
||||
contentFanart=item.fanart,
|
||||
|
||||
@@ -375,8 +375,14 @@ def downloadpage(url, **opt):
|
||||
timeout=opt['timeout'])
|
||||
else:
|
||||
# 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'])
|
||||
# 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):
|
||||
info_dict = fill_fields_pre(url, opt, proxy_data, file_name)
|
||||
|
||||
@@ -110,7 +110,7 @@ def get_videolibrary_support():
|
||||
|
||||
|
||||
def get_channel_url(findhostMethod=None, name=None, forceFindhost=False):
|
||||
from core import jsontools, httptools
|
||||
from core import jsontools
|
||||
import inspect
|
||||
|
||||
LOCAL_FILE = os.path.join(get_runtime_path(), "channels.json")
|
||||
@@ -129,9 +129,7 @@ def get_channel_url(findhostMethod=None, name=None, forceFindhost=False):
|
||||
jsontools.update_node(url, name, 'url')
|
||||
return url
|
||||
else:
|
||||
url = httptools.downloadpage(channels_data['direct'][name], follow_redirects=True, only_headers=True).url
|
||||
if url.endswith('/'): url = url[:-1]
|
||||
return url
|
||||
return channels_data['direct'][name]
|
||||
|
||||
|
||||
def get_system_platform():
|
||||
|
||||
Reference in New Issue
Block a user