1. add xhs pypi
2. fix xhs hashtag 3. qrcode login?
This commit is contained in:
@@ -34,7 +34,11 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
for index, file in enumerate(files):
|
for index, file in enumerate(files):
|
||||||
title, tags = get_title_and_hashtags(str(file))
|
title, tags = get_title_and_hashtags(str(file))
|
||||||
|
# 加入到标题 补充标题(xhs 可以填1000字不写白不写)
|
||||||
tags_str = ' '.join(['#' + tag for tag in tags])
|
tags_str = ' '.join(['#' + tag for tag in tags])
|
||||||
|
hash_tags_str = ''
|
||||||
|
hash_tags = []
|
||||||
|
|
||||||
# 打印视频文件名、标题和 hashtag
|
# 打印视频文件名、标题和 hashtag
|
||||||
print(f"视频文件名:{file}")
|
print(f"视频文件名:{file}")
|
||||||
print(f"标题:{title}")
|
print(f"标题:{title}")
|
||||||
@@ -45,9 +49,16 @@ if __name__ == '__main__':
|
|||||||
for i in tags[:3]:
|
for i in tags[:3]:
|
||||||
topic_official = xhs_client.get_suggest_topic(i)
|
topic_official = xhs_client.get_suggest_topic(i)
|
||||||
if topic_official:
|
if topic_official:
|
||||||
topics.append(topic_official[0])
|
topic_official[0]['type'] = 'topic'
|
||||||
|
topic_one = topic_official[0]
|
||||||
|
hash_tag_name = topic_one['name']
|
||||||
|
hash_tags.append(hash_tag_name)
|
||||||
|
topics.append(topic_one)
|
||||||
|
|
||||||
note = xhs_client.create_video_note(title=title[:20], video_path=str(file), desc=title + tags_str,
|
hash_tags_str = ' ' + ' '.join(['#' + tag + '[话题]#' for tag in hash_tags])
|
||||||
|
|
||||||
|
note = xhs_client.create_video_note(title=title[:20], video_path=str(file),
|
||||||
|
desc=title + tags_str + hash_tags_str,
|
||||||
topics=topics,
|
topics=topics,
|
||||||
is_private=False,
|
is_private=False,
|
||||||
post_time=publish_datetimes[index].strftime("%Y-%m-%d %H:%M:%S"))
|
post_time=publish_datetimes[index].strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
|
|||||||
+3
-1
@@ -3,4 +3,6 @@ playwright
|
|||||||
eventlet
|
eventlet
|
||||||
schedule
|
schedule
|
||||||
cf_clearance
|
cf_clearance
|
||||||
biliup
|
biliup
|
||||||
|
xhs
|
||||||
|
qrcode
|
||||||
@@ -5,11 +5,11 @@ from time import sleep
|
|||||||
|
|
||||||
from xhs import XhsClient
|
from xhs import XhsClient
|
||||||
|
|
||||||
from xhs_uploader.main import sign
|
from xhs_uploader.main import sign_local, sign
|
||||||
|
|
||||||
# pip install qrcode
|
# pip install qrcode
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
xhs_client = XhsClient(sign=sign)
|
xhs_client = XhsClient(sign=sign, timeout=60)
|
||||||
print(datetime.datetime.now())
|
print(datetime.datetime.now())
|
||||||
qr_res = xhs_client.get_qrcode()
|
qr_res = xhs_client.get_qrcode()
|
||||||
qr_id = qr_res["qr_id"]
|
qr_id = qr_res["qr_id"]
|
||||||
@@ -20,8 +20,7 @@ if __name__ == '__main__':
|
|||||||
border=1)
|
border=1)
|
||||||
qr.add_data(qr_res["url"])
|
qr.add_data(qr_res["url"])
|
||||||
qr.make()
|
qr.make()
|
||||||
img = qr.make_image(fill_color="black", back_color="white")
|
qr.print_ascii()
|
||||||
img.save('qrcode.png')
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
check_qrcode = xhs_client.check_qrcode(qr_id, qr_code)
|
check_qrcode = xhs_client.check_qrcode(qr_id, qr_code)
|
||||||
|
|||||||
Reference in New Issue
Block a user