|
@@ -2,8 +2,11 @@
|
|
|
"""
|
|
|
@author: luojunhui
|
|
|
"""
|
|
|
+import time
|
|
|
import json
|
|
|
import uuid
|
|
|
+import random
|
|
|
+import hashlib
|
|
|
import requests
|
|
|
import urllib.parse
|
|
|
|
|
@@ -62,8 +65,19 @@ def create_gzh_path(video_id, shared_uid):
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
return response.json()['content']
|
|
|
|
|
|
+ def generate_source_id():
|
|
|
+ """
|
|
|
+ generate_source_id
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ timestamp = str(int(time.time() * 1000))
|
|
|
+ random_str = str(random.randint(1000, 9999))
|
|
|
+ hash_input = f"{timestamp}-{random_str}"
|
|
|
+ return hashlib.md5(hash_input.encode()).hexdigest()
|
|
|
+
|
|
|
root_share_id = str(uuid.uuid4())
|
|
|
- url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&rootShareId={root_share_id}&shareId={root_share_id}"
|
|
|
+ source_id = "longArticles_" + generate_source_id()
|
|
|
+ url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&rootShareId={root_share_id}&shareId={root_share_id}&rootSourceId={source_id}"
|
|
|
# 自动把 root_share_id 加入到白名单
|
|
|
auto_white(root_share_id)
|
|
|
return root_share_id, f"pages/category?jumpPage={urllib.parse.quote(url, safe='')}"
|