add proxies on lain.la requests

master
Aevann1 2022-09-26 04:40:21 +02:00
parent 6158cf632a
commit 0a83feb966
1 changed files with 3 additions and 5 deletions

View File

@ -30,7 +30,7 @@ def process_files():
def process_other(file): def process_other(file):
req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': file}, timeout=20).json() req = requests.post("https://pomf2.lain.la/upload.php", files={'files[]': file}, timeout=20, proxies=proxies).json()
return req['files'][0]['url'] return req['files'][0]['url']
@ -47,8 +47,7 @@ def process_audio(file):
if os.stat(name).st_size > 8 * 1024 * 1024: if os.stat(name).st_size > 8 * 1024 * 1024:
with open(name, 'rb') as f: with open(name, 'rb') as f:
os.remove(name) os.remove(name)
req = requests.request("POST", "https://pomf2.lain.la/upload.php", req = requests.post("https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=20, proxies=proxies).json()
files={'files[]': f}, timeout=20).json()
return req['files'][0]['url'] return req['files'][0]['url']
return f'{SITE_FULL}{name}' return f'{SITE_FULL}{name}'
@ -68,8 +67,7 @@ def process_video(file):
if os.stat(new).st_size > 8 * 1024 * 1024: if os.stat(new).st_size > 8 * 1024 * 1024:
with open(new, 'rb') as f: with open(new, 'rb') as f:
os.remove(new) os.remove(new)
req = requests.request("POST", "https://pomf2.lain.la/upload.php", req = requests.post("https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=20, proxies=proxies).json()
files={'files[]': f}, timeout=20).json()
return req['files'][0]['url'] return req['files'][0]['url']
return f'{SITE_FULL}{new}' return f'{SITE_FULL}{new}'