我有 450mb 的视频。我想将它上传到我在脚本中使用的 xvideos.com
xvideos_log_data = {'login': xv_login,
'password': password,
'referer': 'http://upload.xvideos.com/account',
'log': 'Login to your account'}
def xvideos(f_path):
_print('xvideos started uploading...')
try:
s = requests.Session()
s.post('http://upload.xvideos.com/account', data=xvideos_log_data, headers=headers)
rp = s.get('http://upload.xvideos.com/account/uploads/new')
apc = re.search(r'onclick="launch_upload_basic\(\'(.*?)\'\)', rp.text).group(1)
payload = {'APC_UPLOAD_PROGRESS': apc,
'message': ''}
r = s.post('http://upload.xvideos.com/account/uploads/submit?video_type=other',
data=payload,
files={'upload_file': open(f_path, 'rb')}, headers=headers)
edt = re.search(r'<a href="(.*?)" target="_top"', r.text)
if edt is None:
_print(re.search(r'inlineError.*>(.*?)<', r.text).group(1))
return
payload = {'title': make_title(),
'keywords': ' '.join(make_tags()),
'description': choice(description),
'hide': 0,
'update_video_information': 'Update information'}
r = s.post('http://upload.xvideos.com' + edt.group(1), data=payload, headers=headers)
_print('xvideos finished uploading')
except Exception as error:
_print(error)
finally:
return
问题是上传很慢,但是成功了。我在我的服务器上启动脚本。当我尝试在浏览器中上传时 - 它很快。
可能是什么问题呢?