上传前先登录

This commit is contained in:
2022-07-25 16:29:05 +08:00
parent ef10d0bf0f
commit 3e1fae2183
5 changed files with 72 additions and 2 deletions

View File

@ -50,6 +50,7 @@ def auto_submit_task():
_result = _f.result()
if _result:
# start uploading
bilibili_instance.login()
bilibili_instance.upload(parts=_result,
title=bili_record_workflow_item.name,
desc=VIDEO_DESC,

View File

@ -0,0 +1,19 @@
from flask import Blueprint, jsonify
from workflow.bilibili import INSTANCE as BILIBILI_INSTANCE
blueprint = Blueprint("api_biliuploader", __name__, url_prefix="/api/biliuploader")
@blueprint.get("/")
def get_login_info():
return jsonify({
"mid": BILIBILI_INSTANCE.user_id,
"expires": BILIBILI_INSTANCE.expires,
"login_at": BILIBILI_INSTANCE.login_time,
})
@blueprint.post("/")
def do_login():
BILIBILI_INSTANCE.login()
return get_login_info()