domini CF basati sui canali

This commit is contained in:
marco
2020-02-28 18:46:15 +01:00
parent 74ad4469eb
commit 2625cd446b
2 changed files with 20 additions and 10 deletions
+10 -5
View File
@@ -12,11 +12,10 @@ except ImportError:
import urllib, urlparse, cookielib
import inspect, os, time, json
import os, time, json
from threading import Lock
from core.jsontools import to_utf8
from platformcode import config, logger
from platformcode.logger import WebErrorException
from core import scrapertools
# Get the addon version
@@ -42,6 +41,13 @@ if HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT == 0: HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT =
# Random use of User-Agents, if nad is not specified
HTTPTOOLS_DEFAULT_RANDOM_HEADERS = False
domainCF = list()
channelsCF = ['guardaserieclick', 'casacinema', 'dreamsub', 'ilgeniodellostreaming', 'piratestreaming', 'altadefinizioneclick']
otherCF = ['altadefinizione-nuovo.link', 'wstream.video', 'akvideo.stream', 'backin.net']
for ch in channelsCF:
domainCF.append(urlparse.urlparse(config.get_channel_url(name=ch)).hostname)
domainCF.extend(otherCF)
def get_user_agent():
# Returns the global user agent to be used when necessary for the url.
return default_headers["User-Agent"]
@@ -253,10 +259,9 @@ def downloadpage(url, **opt):
url = scrapertools.unescape(url)
load_cookies()
domain = urlparse.urlparse(url).netloc
global domainCF
CF = False
if domain in ['www.guardaserie.media', 'casacinema.space', 'wstream.video', 'akvideo.stream', 'backin.net',
'dreamsub.stream', 'altadefinizione-nuovo.link', 'ilgeniodellostreaming.si', 'www.piratestreaming.gratis',
'altadefinizione.style']:
if domain in domainCF:
from lib import cloudscraper
session = cloudscraper.create_scraper()
CF = True