测试抖音视频
This commit is contained in:
@@ -127,7 +127,7 @@ class DouyinParser:
|
||||
clean_url = self._clean_url(url)
|
||||
params = {'url': clean_url, 'type': 'json'}
|
||||
|
||||
self.LOG.debug("[抖音] 请求API: %s, 参数: %s", api_url, repr(params))
|
||||
self.LOG.info("[抖音] 请求API: %s, 参数: %s", api_url, repr(params))
|
||||
proxy = {"http": self.http_proxy, "https": self.http_proxy} if self.http_proxy else None
|
||||
response = requests.get(api_url, params=params, timeout=30, proxies=proxy)
|
||||
|
||||
@@ -135,10 +135,11 @@ class DouyinParser:
|
||||
raise DouyinParserError(f"API请求失败,状态码: {response.status_code}")
|
||||
|
||||
data = response.json()
|
||||
self.LOG.debug("[抖音] API响应数据: %s", data)
|
||||
self.LOG.info("[抖音] API响应数据: %s", data)
|
||||
|
||||
if data.get("code") == 200:
|
||||
result = data.get("data", {})
|
||||
self.LOG.info("[抖音] API响应数据result: %s", result)
|
||||
# if result.get('video'):
|
||||
# result['video'] = self._get_real_video_url(result['video'])
|
||||
return self._clean_response_data(result)
|
||||
@@ -180,6 +181,7 @@ class DouyinParser:
|
||||
|
||||
self.wcf.send_rich_text("bot", "gh_11", title[:30], f"{title[:30]} - {author[:10]}", video_url, cover,
|
||||
message.roomid)
|
||||
self.LOG.info(f"video_url: {video_url}, title: {title}, author: {author}, cover: {cover}")
|
||||
mp4_path = self.download_stream(video_url, "douyin_parser/down_load_dir/douyin.mp4")
|
||||
self.LOG.info(f"发送抖音视频:{mp4_path}")
|
||||
self.wcf.send_file(mp4_path, message.roomid)
|
||||
|
||||
Reference in New Issue
Block a user