From ce1d04ae644267abc232f791e4e3051edc821698 Mon Sep 17 00:00:00 2001 From: "a.chernenko" Date: Wed, 19 Nov 2025 18:03:31 +1000 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=BF=D0=BE=D0=B4=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download.py | 8 ++++++-- include/http_header.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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"), ]