altre ottimizzazioni

This commit is contained in:
marco
2020-03-31 14:49:00 +02:00
parent e44578c4a3
commit ff79e499a9
12 changed files with 41 additions and 30 deletions
+1 -1
View File
@@ -123,6 +123,7 @@ def load_cookies(alfa_s=False):
os.remove(cookies_file)
cookies_lock.release()
load_cookies()
def save_cookies(alfa_s=False):
cookies_lock.acquire()
@@ -255,7 +256,6 @@ def downloadpage(url, **opt):
"""
url = scrapertools.unescape(url)
load_cookies()
domain = urlparse.urlparse(url).netloc
global domainCF
CF = False
+2 -1
View File
@@ -387,7 +387,8 @@ def scrape(func):
if not data:
page = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True)
# if url may be changed and channel has findhost to update
if (not page.data or scrapertools.get_domain_from_url(page.url) != scrapertools.get_domain_from_url(item.url)) and 'findhost' in func.__globals__:
if 'findhost' in func.__globals__ and (not page.data or scrapertools.get_domain_from_url(page.url).lower() != scrapertools.get_domain_from_url(item.url).lower()):
logger.info('running findhost ' + func.__module__)
host = func.__globals__['findhost']()
parse = list(urlparse.urlparse(item.url))
from core import jsontools