Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.0.1.6 pw2累计更新修复 24/May/04 - 24/Jun/28 #106

Merged
merged 300 commits into from
Jun 28, 2024

Conversation

Johnserf-Seed
Copy link
Owner

[0.0.1.6] - 2024-05-04

Added

  • 添加weibo应用
  • 添加abogus(limit ua)加密
  • 添加douyin加密算法切换配置
  • 添加基础接口模型转url类
  • 添加WebSocket爬虫客户端
  • 添加douyin直播wss签名管理器
  • 添加douyin直播wss签名生成类
  • 添加douyin工具JS库webmssdk.es5-1.0.0.53
  • 添加douyin直播间弹幕wss接口
  • 添加F2版本检测
  • 添加tiktok直播间开播状态
  • 添加PyExecJS==1.5.1依赖
  • 添加protobuf==4.23.0依赖
  • 添加websockets>=11.0依赖
  • 添加tiktokdevice_id注册cookie管理类
  • 添加douyin生成webid配置
  • 添加douyin关注用户直播
  • 添加douyintiktok模型配置
  • 添加conf.yaml配置版本号
  • 添加tiktok集成测试
  • 添加traceback输出
  • 添加douyin短剧作品
  • 添加同步客户端的同步transport
  • 添加同步客户端
  • 添加douyin直播弹幕初始化
  • 添加douyin合集mix_id获取方法
  • 添加douyin查询用户
  • 添加时间戳转换的默认时区设置(UTC/GMT+08:00
  • 添加ClientConfManager为每个应用提供方便的配置读取
  • 添加uniqueId查询tiktokuser_db
  • 添加获取segmentsduration列表方法
  • 添加应用运行模式的输出
  • 新增tiktok作品搜索
  • 新增tiktok用户直播
  • 添加反转义JSON方法
  • 新增douyin相关推荐
  • 新增douyin好友作品

Changed

  • 更新__aexit__方法
  • 更新douyin加密算法代码片段
  • 更新weibo测试用例
  • 优化命令不存在的输出
  • 取消接口数据过滤器对bool的预处理
  • 调整停止异步任务信号
  • 更新douyinxbogus调用
  • 为装饰器文件重命名
  • 更新获取Content-Length的方法
  • 防止douyin直播结束时下载崩溃
  • 更新BaseCrawler类处理httpx即将弃用proxies参数
  • 更新tiktokmsToken配置
  • 修复ClientConfManager参数
  • 更新了所有应用配置
  • 重构了所有工具类方法
  • 更新base_downloader的区块下载参数
  • 修改douyin生成的ttwid将绑定ua
  • 修改tiktok用户直播下载流地址
  • 修改douyintiktok获取用户信息方法名
  • 完善时间戳转换类型,支持30位
  • 修改应用的代理配置名(http: https: -> http://: https://:
  • 更新xb算法示例部分
  • 更新base_crawler异常捕获与输出
  • 更新应用初始化配置文件后退出 ([BUG] --init-config 出错:缺乏URL参数,详情看命令帮助 #70)
  • 更新应用使用--auto-cookie命令后退出
  • 更新douyin过滤器,将video_play_addr返回完整视频列表便于下载失败轮替
  • 更改douyin图集文件名(jpg -> webp
  • 更改应用直播下载文件名(mp4 -> flv
  • 更新应用工具类网络错误捕获

Deprecated

  • 弃用douyinSSO扫码登录
  • BaseModel中的dict方法已弃用(pydantic>=2.6.4)
  • datetime中的utcnow方法已弃用
  • 弃用douyintiktok获取用户名方法

Removed

  • 删除tiktok基础请求模型的无用参数
  • 删除f2\utils\utils.py无效导入

Fixed

Security

  • 更新pytest版本到8.2.1
  • 更新pydantic版本到2.6.4
  • 更新httpx版本到0.27.0
  • 更新aiosqlite版本到0.20.0

Resolve

#104
#103
#102
#99
#98
#95
#88
#79
#78
Johnserf-Seed/TikTokDownload#703
Johnserf-Seed/TikTokDownload#718
Johnserf-Seed/TikTokDownload#711
Johnserf-Seed/TikTokDownload#702

适用于嵌套的带转义字符的json
添加了一些ssl错误的解决方案
添加status_code和exclude_list
Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth considering. View full project report here.

f2/apps/douyin/crawler.py Show resolved Hide resolved
return data_dict

@classmethod
async def WebcastLikeMessage(self, data: bytes):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async def WebcastLikeMessage(self, data: bytes):
async def WebcastLikeMessage(cls, data: bytes):

Likewise, Consider using cls instead.

)
logger.info(
"[WebcastLikeMessage] [👍点赞消息] | "
+ "[用户Id:{0}] [当前用户点赞:{1}] [总点赞:{2}]".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string is easier to read, write, and less computationally expensive than legacy string formatting. More info.

return data_dict

@classmethod
async def WebcastMemberMessage(self, data: bytes):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async def WebcastMemberMessage(self, data: bytes):
async def WebcastMemberMessage(cls, data: bytes):

Likewise, Consider using cls instead.

return data_dict

@classmethod
async def WebcastChatMessage(self, data: bytes):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async def WebcastChatMessage(self, data: bytes):
async def WebcastChatMessage(cls, data: bytes):

As above, Consider using cls instead.

except httpx.NetworkError as exc:
logger.error(traceback.format_exc())
raise APIConnectionError(
"{0}。 链接:{1},代理:{2},异常类名:{3},异常详细信息:{4}".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, Consider using f-string instead.

except httpx.ProtocolError as exc:
logger.error(traceback.format_exc())
raise APIUnauthorizedError(
"{0}。 链接:{1},代理:{2},异常类名:{3},异常详细信息:{4}".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, Consider using f-string instead.

except httpx.ProxyError as exc:
logger.error(traceback.format_exc())
raise APIConnectionError(
"{0}。 链接:{1},代理:{2},异常类名:{3},异常详细信息:{4}".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: Consider using f-string instead.

except httpx.HTTPStatusError as exc:
logger.error(traceback.format_exc())
raise APIResponseError(
"{0}。链接:{1} 代理:{2},异常类名:{3},异常详细信息:{4}".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, Consider using f-string instead.

_("输入的URL List不合法。类名:{0}").format(cls.__name__)
)
raise APINotFoundError(
"输入的URL List不合法。类名:{0}".format(cls.__name__)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, Consider using f-string instead.

Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Worth considering though. View full project report here.

if response.status_code in {200, 444}:
if cls._TIKTOK_NOTFOUND_PARREN.search(str(response.url)):
raise APINotFoundError(
"页面不可用,可能是由于区域限制(代理)造成的。类名:{0}".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: Consider using f-string instead.

tweet_media_url = [tweet_data_dict.get("tweet_media_url")]
for i, image_url in enumerate(tweet_media_url):
image_name = f"{format_file_name(kwargs.get('naming'), tweet_data_dict)}_image_{i + 1}"
if image_url != None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if image_url != None:
if image_url is not None:

None is a singleton data type, so should be compared using is not. More info.

try:
return naming_template.format(**fields)
except KeyError as e:
raise KeyError(_("文件名模板字段 {0} 不存在,请检查".format(e)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string is easier to read, write, and less computationally expensive than legacy string formatting. Explained here.

for i, image_url in enumerate(weibo_data_dict.get("pic_infos")):
image_name = f"{format_file_name(kwargs.get('naming'), weibo_data_dict)}_image_{i + 1}"
image_url = WeiboAPIEndpoints.LARGEST + f"/{image_url}"
if image_url != None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if image_url != None:
if image_url is not None:

None is a singleton data type, so should be compared using is not. Read more.

try:
return naming_template.format(**fields)
except KeyError as e:
raise KeyError(_("文件名模板字段 {0} 不存在,请检查".format(e)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string is easier to read, write, and less computationally expensive than legacy string formatting. More info.

@@ -74,10 +91,12 @@ async def get_content_length(url: str, headers: dict = {}, proxies: dict = {}) -
)
return 0
except httpx.RequestError as e:
logger.error(f"httpx 请求错误: {0}, 错误详情: {1}".format(url, e))
logger.error(traceback.format_exc())
logger.error(_("httpx 请求错误:{0},错误详情:{1}".format(url, e)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string is easier to read, write, and less computationally expensive than legacy string formatting. More details.

)

abogus = self.crypto_utility.abogus_encode(abogus_bytes_str, 0)
params = "%s&a_bogus=%s" % (params, abogus)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
params = "%s&a_bogus=%s" % (params, abogus)
params = f"{params}&a_bogus={abogus}"

f-string is easier to read, write, and less computationally expensive than legacy string formatting. Read more.

"""

# 将输入字符串转换为ASCII码的二进制形式
binary_string = "".join(["{:08b}".format(ord(char)) for char in input_string])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, Consider using f-string instead.

@@ -216,16 +219,21 @@ def getXBogus(self, url_path):
ord(garbled_code[idx + 2]),
)
idx += 3
self.params = "%s&X-Bogus=%s" % (url_path, xb_)
self.params = "%s&X-Bogus=%s" % (url_params, xb_)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.params = "%s&X-Bogus=%s" % (url_params, xb_)
self.params = f"{url_params}&X-Bogus={xb_}"

f-string is easier to read, write, and less computationally expensive than legacy string formatting. More.

@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@Johnserf-Seed Johnserf-Seed merged commit 77d9709 into main Jun 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants