强制要求输入机器号
This commit is contained in:
parent
274f0ac664
commit
1c2b697a3c
@ -57,8 +57,10 @@ class RetryRequests:
|
||||
kwargs.setdefault("proxies", self.proxies)
|
||||
return self.session.post(url, **kwargs)
|
||||
|
||||
|
||||
req = RetryRequests()
|
||||
|
||||
|
||||
def clean_dash_to_zero(val):
|
||||
if val in ('-', '', None):
|
||||
return 0
|
||||
@ -227,6 +229,7 @@ class DMVideoInfo:
|
||||
print(f"[ERROR] 请求失败 vxid={v_xid} : {e}")
|
||||
return None
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
global MACHINE_ID
|
||||
parser = argparse.ArgumentParser(
|
||||
@ -247,6 +250,7 @@ def parse_args() -> argparse.Namespace:
|
||||
raise ValueError("请指定机器编号")
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
kwdata = db.get_web_items()
|
||||
if not kwdata:
|
||||
@ -637,7 +641,7 @@ def main():
|
||||
payload = json.dumps(data).encode()
|
||||
|
||||
response = req.post('https://graphql.api.dailymotion.com/', headers=headers, data=payload,
|
||||
proxies=proxies)
|
||||
proxies=proxies)
|
||||
|
||||
data = response.json()
|
||||
edges = data['data']['search']['stories']['edges']
|
||||
@ -661,11 +665,14 @@ def main():
|
||||
executor.map(dmvideo_info.get_video_info, tancks)
|
||||
if edges_len < 20:
|
||||
break
|
||||
|
||||
|
||||
def run():
|
||||
parse_args()
|
||||
while True:
|
||||
main()
|
||||
time.sleep(60)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user