|
|
@ -10,12 +10,13 @@ get_end_date = '2023-08-09' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 整理链接格式 |
|
|
|
# 整理链接格式 |
|
|
|
def format_link(link): |
|
|
|
def format_link(link, code): |
|
|
|
if '?pwd=' in link: |
|
|
|
if '?pwd=' in link: |
|
|
|
link = link[:-9] |
|
|
|
link = link[:-9] |
|
|
|
|
|
|
|
# code = link[-4:] |
|
|
|
if 'init?surl=' in link: |
|
|
|
if 'init?surl=' in link: |
|
|
|
link = 'https://pan.baidu.com/s/1' + link[38:60] |
|
|
|
link = 'https://pan.baidu.com/s/1' + link[38:60] |
|
|
|
return link |
|
|
|
return link, code |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 封装通用方法 |
|
|
|
# 封装通用方法 |
|
|
@ -25,9 +26,9 @@ def req(_data, req_obj, db_obj): |
|
|
|
save_path = [base_temp_path, _data['cate'] + '_' + date_str + r'/', str(_data['id'])] |
|
|
|
save_path = [base_temp_path, _data['cate'] + '_' + date_str + r'/', str(_data['id'])] |
|
|
|
print('-' * 30 + str(_data['id']) + '-' * 30) |
|
|
|
print('-' * 30 + str(_data['id']) + '-' * 30) |
|
|
|
print(save_path) |
|
|
|
print(save_path) |
|
|
|
link = format_link(_data['save_link']) |
|
|
|
link, code = format_link(_data['save_link'], _data['code']) |
|
|
|
print(_data['save_link'], ' -> ', link, ' ', _data['code']) |
|
|
|
print(_data['save_link'], ' -> ', link, ' ', _data['code'], ' -> ', code) |
|
|
|
result, name = req_obj.process(save_path, link, _data['code']) |
|
|
|
result, name = req_obj.process(save_path, link, code) |
|
|
|
if result: |
|
|
|
if result: |
|
|
|
db_obj.update_file_name(_data['id'], name) |
|
|
|
db_obj.update_file_name(_data['id'], name) |
|
|
|
print(f'{_data["id"]}保存成功' + '\n' * 2) |
|
|
|
print(f'{_data["id"]}保存成功' + '\n' * 2) |
|
|
@ -69,6 +70,8 @@ def main(): |
|
|
|
db_obj.mark_failed(_data['id']) |
|
|
|
db_obj.mark_failed(_data['id']) |
|
|
|
print('重试后依然失败:') |
|
|
|
print('重试后依然失败:') |
|
|
|
print(failed_id) |
|
|
|
print(failed_id) |
|
|
|
|
|
|
|
print('请手动重试以下链接:') |
|
|
|
|
|
|
|
print(db_obj.get_retry()) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print(e) |
|
|
|
print(e) |
|
|
|
finally: |
|
|
|
finally: |
|
|
|