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