12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- # -*- coding: utf-8 -*-
- # @Author: wangkun
- # @Time: 2022/6/13
- import json
- import time
- import requests
- from main.feishu_lib import Feishu
- class Demo:
- @classmethod
- def get_video_info(cls, session, vid):
- url = "https://search.weixin.qq.com/cgi-bin/recwxa/recwxagetonevideoinfo?"
- param = {
- "session": session,
- "vid": vid,
- "wxaVersion": "3.9.2",
- "channelid": "208201",
- "scene": "32",
- "subscene": "1089",
- "model": "iPhone 11<iPhone12,1>14.7.1",
- "clientVersion": "8.0.18",
- "sharesearchid": "447665862521758270",
- "sharesource": "-1"
- }
- r = requests.get(url=url, params=param)
- response = json.loads(r.content.decode("utf8"))
- data = response["data"]
- v_title = data["title"]
- v_play_cnt = data["played_cnt"]
- v_comment_cnt = data["comment_cnt"]
- v_liked_cnt = data["liked_cnt"]
- v_shared_cnt = data["shared_cnt"]
- v_duration = data["duration"]
- v_width = data["width"]
- v_height = data["height"]
- v_send_date = data["upload_time"]
- v_username = data["user_info"]["nickname"].strip().replace("\n", "")
- v_user_id = data["openid"]
- v_user_cover = data["user_info"]["headimg_url"]
- v_video_cover = data["cover_url"]
- v_url = data["play_info"]["items"][-1]["play_url"]
- print(f"v_title:{v_title}")
- print(f"v_play_cnt:{v_play_cnt}")
- print(f"v_liked_cnt:{v_liked_cnt}")
- print(f"v_comment_cnt:{v_comment_cnt}")
- print(f"v_shared_cnt:{v_shared_cnt}")
- print(f"v_duration:{v_duration}")
- print(f"v_url:{v_url}")
- @classmethod
- def strtime_to_int(cls):
- download_time = "2022/06/13 17:21:01"
- download_time = int(time.mktime(time.strptime(download_time, "%Y/%m/%d %H:%M:%S")))
- print(download_time)
- @classmethod
- def demo1(cls):
- a = 10
- b = 20
- lines = len(Feishu.get_values_batch("C8LQ1b"))
- for i in range(1, lines):
- print(f"i:{i}")
- if i == a or i == b:
- print(f"正在删除:{i+1}行")
- Feishu.dimension_range("C8LQ1b", "ROWS", i+1, i+1)
- lines = lines-1
- if __name__ == "__main__":
- demo = Demo()
- session = "LHacJPGEcMn7Cb0ocD_Z1BDyCkRbNjux4_HuHAwpydcHHdw9uwJl9pyiZgD__06uuDUwZ-_vqY5XQ_mS0XFz43xUYxwE_HsmxvluYfOVR5kXJmgjEVMlSDJ-R2IRr6ObHVZDaSLPV_i52pL0joEWP3FSHOZpXa72I9SPFUdQ1LRRGVvEhQBxMjuqvymnK5bv1HJwS_UoDIoue2nOrWmTCCAiR7YOUGnE8pwL0RLxsxSXU_fa3Ujgr9SbzFf3WhPo_QV92loTyXBTCJ8V8FsISqSKRlupG4n7osIyvEgtJEMS4Lt8K14Pc9i6X4e2EDUwoY66dOYbaoG5jaYgtdzKdYICRKnUK8jg_EAiSW7xzuorOLyoGDXlpL3AjVfivcys98Dg5b-BwTx7YhjUSbyVfDKrA5NFUY8cXJAJ2jWM6SSL91UNXVse7k4e8gMRGceC"
- videoid = "ugc_xnl1c7"
- demo.get_video_info(session, videoid)
- # demo.strtime_to_int()
- # demo.demo1()
- # Feishu.insert_columns("C8LQ1b", "ROWS", 1, 2)
|