diff --git a/download.py b/download.py index 00b3608..7b112bf 100755 --- a/download.py +++ b/download.py @@ -66,7 +66,9 @@ def list_ip(c_dict: dict = []): # бежим весь список ссылок пока не код 200 for c_url in c_list['url']: try: - if (result:=requests.get(c_url, headers=get_headers())) and result.status_code == 200 and result.text: + session = requests.Session() + session.headers.update(get_headers()) + if (result:=session.get(c_url)) and result.status_code == 200 and result.text: print(f"URL: {c_url}") # пополняем словарь ipv4_list if ipv4: ipv4_list.update(ipv4_find(result.text,ipv4)) @@ -130,7 +132,9 @@ if __name__ == "__main__": try: # если файл list ссылка, загружаем и парсим его with open(list_file, "r") as file: - if (result:=requests.get(url_list_file:=file.readline().strip(), headers=get_headers())) and result.status_code == 200 and result.text: + session = requests.Session() + session.headers.update(get_headers()) + if (result:=session.get(url_list_file:=file.readline().strip())) and result.status_code == 200 and result.text: ip_list = ast.literal_eval(result.text) print(f"Список выгрузки по url: {url_list_file}") except requests.exceptions.MissingSchema: diff --git a/include/http_header.py b/include/http_header.py index 5c8d9c5..a425edf 100644 --- a/include/http_header.py +++ b/include/http_header.py @@ -60,7 +60,7 @@ def get_headers(): ("User-Agent", user_agent), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"), ("Accept-Language", accept_lang), - ("Accept-Encoding", "gzip, deflate, br"), + ("Accept-Encoding", "gzip, deflate, br, zstd"), ("Connection", "keep-alive"), ("Upgrade-Insecure-Requests", "1"), ]