mirror of
				https://github.com/taixingyiji/openit.git
				synced 2025-10-31 14:02:20 +00:00 
			
		
		
		
	Update main.py
This commit is contained in:
		| @@ -7,10 +7,12 @@ import time | |||||||
| import yaml | import yaml | ||||||
| import requests | import requests | ||||||
|  |  | ||||||
|  | headers = {'User-Agent': 'clash', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive'} | ||||||
|  |  | ||||||
| def fetch(proxy_list, filename): | def fetch(proxy_list, filename): | ||||||
|     current_date = time.strftime("%Y_%m_%d", time.localtime()) |     current_date = time.strftime("%Y_%m_%d", time.localtime()) | ||||||
|     baseurl = 'https://raw.githubusercontent.com/changfengoss/pub/main/data/' |     baseurl = 'https://raw.githubusercontent.com/changfengoss/pub/main/data/' | ||||||
|     working = yaml.safe_load(requests.get(url=baseurl + current_date + '/' + filename, ).text) |     working = yaml.safe_load(requests.get(url=baseurl + current_date + '/' + filename, timeout=10).text) | ||||||
|     data_out = [] |     data_out = [] | ||||||
|     for x in working['proxies']: |     for x in working['proxies']: | ||||||
|         data_out.append(x) |         data_out.append(x) | ||||||
| @@ -19,7 +21,7 @@ def fetch(proxy_list, filename): | |||||||
| def url(proxy_list, link): | def url(proxy_list, link): | ||||||
|     try: |     try: | ||||||
|         data_out=[] |         data_out=[] | ||||||
|         working = yaml.safe_load(requests.get(url=link).text) |         working = yaml.safe_load(requests.get(url=link,timeout=10, headers=headers).text) | ||||||
|         for x in working['proxies']: |         for x in working['proxies']: | ||||||
|             data_out.append(x) |             data_out.append(x) | ||||||
|         proxy_list.append(data_out) |         proxy_list.append(data_out) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user