|
@@ -87,8 +87,8 @@ class GZXHAuthor:
|
|
|
driver = webdriver.Chrome(desired_capabilities=ca, options=chrome_options)
|
|
|
else:
|
|
|
driver = webdriver.Chrome(
|
|
|
- desired_capabilities=ca,
|
|
|
- options=chrome_options,
|
|
|
+ # desired_capabilities=ca,
|
|
|
+ # options=chrome_options,
|
|
|
service=Service(
|
|
|
"/Users/tzld/Downloads/chromedriver_mac64/chromedriver"
|
|
|
),
|
|
@@ -198,7 +198,7 @@ class GZXHAuthor:
|
|
|
env=self.env,
|
|
|
data=article,
|
|
|
)
|
|
|
- repeat_flag = self.process_video_obj(article, user_name)
|
|
|
+ repeat_flag = self.process_video_obj(article, user_name, wechat_gh)
|
|
|
if not repeat_flag:
|
|
|
return
|
|
|
except Exception as e:
|
|
@@ -213,22 +213,25 @@ class GZXHAuthor:
|
|
|
|
|
|
|
|
|
|
|
|
- def process_video_obj(self, article, user_name):
|
|
|
+ def process_video_obj(self, article, user_name, wechat_gh):
|
|
|
trace_id = self.platform + str(uuid.uuid1())
|
|
|
publish_time_str = article.get("published_time", 0)
|
|
|
date_format = "%Y-%m-%d %H:%M:%S"
|
|
|
date_time_obj = datetime.strptime(publish_time_str, date_format)
|
|
|
publish_time_stamp = int(date_time_obj.timestamp())
|
|
|
article_url = article.get("url", "")
|
|
|
+ id = article.get("id", "")
|
|
|
+ video_id = wechat_gh + id
|
|
|
+ cover_url = article.get("head_pic", "")
|
|
|
video_url = self.get_video_url(article_url)
|
|
|
video_dict = {
|
|
|
"user_name": user_name,
|
|
|
- "video_id": article.get("aid", ""),
|
|
|
+ "video_id": video_id,
|
|
|
"video_title": article.get("title", "")
|
|
|
.replace(" ", "")
|
|
|
.replace('"', "")
|
|
|
.replace("'", ""),
|
|
|
- "out_video_id": article.get("aid", ""),
|
|
|
+ "out_video_id": video_id,
|
|
|
"publish_time_stamp": publish_time_stamp,
|
|
|
"publish_time_str": publish_time_str,
|
|
|
"play_cnt": 0,
|
|
@@ -236,7 +239,7 @@ class GZXHAuthor:
|
|
|
"like_cnt": 0,
|
|
|
"share_cnt": 0,
|
|
|
"user_id": self.user_dict["uid"],
|
|
|
- "cover_url": article.get("head_pic", ""),
|
|
|
+ "cover_url": cover_url,
|
|
|
"video_url": video_url,
|
|
|
"width": 0,
|
|
|
"height": 0,
|
|
@@ -278,7 +281,6 @@ class GZXHAuthor:
|
|
|
video_url,
|
|
|
article.get("head_pic", ""),
|
|
|
self.user_dict['link']
|
|
|
-
|
|
|
]]
|
|
|
Feishu.insert_columns('gongzhonghao', 'gongzhonghao', "9QU7wE", "ROWS", 1, 2)
|
|
|
time.sleep(0.5)
|
|
@@ -299,4 +301,14 @@ class GZXHAuthor:
|
|
|
return True
|
|
|
|
|
|
|
|
|
+if __name__ == "__main__":
|
|
|
+ GZ = GZXHAuthor(
|
|
|
+
|
|
|
+ platform="gongzhongxinhao",
|
|
|
+ mode="author",
|
|
|
+ user_dict={"uid": "123456", "link": "https://mp.weixin.qq.com/s/Cwc2D3RUNDk30zv_s0IxTA", "user_id": "1234565"},
|
|
|
+ rule_dict={},
|
|
|
+ env="dev",
|
|
|
+ )
|
|
|
|
|
|
+ GZ.get_account_videos()
|