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

add info.live=True states to douyin/live.py which ensure timestre in filename. #624

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion ykdl/extractors/douyin/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Douyin(Extractor):
}

def prepare(self):
info = MediaInfo(self.name)
info = MediaInfo(self.name,True)

if 'amemv.com' in self.url:
data = get_response('https://webcast.amemv.com/webcast/room/reflow/info/',
Expand Down
4 changes: 4 additions & 0 deletions ykdl/extractors/douyu/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def prepare(self):

add_header('Referer', 'https://www.douyu.com')
html = get_content(self.url)

videoloop_label = match1(
html, '\$ROOM\.room_biz_all\s*=\s*\{\"videoLoop\":(\d+)')
assert not (videoloop_label == '1') , 'Douyu重播'
Copy link
Collaborator

@SeaHOH SeaHOH Jun 29, 2023

Choose a reason for hiding this comment

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

这里不应退出,我认为可以选择以下两个方案之一:

  • 如果可以,则重定向到 douyu/video (不确定是否有对应的视频)。

  • 修改 info = MediaInfo('斗鱼重播 (DouyuTV)'),后面的 title 也作相应修改。

Copy link
Contributor Author

@a67878813 a67878813 Jul 13, 2023

Choose a reason for hiding this comment

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

1.即使重定向到douyu/video,估计不会暴露视频地址。
2.info补全后,返回的MediaInfo结构需添加额外flag,需要增加命令行参数才能做出“给定直播地址,存在回放标识,停止录制”功能。这样可接受吗?
7x24全开时,开回放的直播间很麻烦。(回放-直播)的ts流结构不正常。

Copy link
Collaborator

Choose a reason for hiding this comment

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

ykdl 自带的 cykdl 事实上只是一个范例,ykdl 本身定位是作为库来调用的,需要保持功能完整没有无故缺失。如果有更复杂的要求,可以另行编写脚本调用 ykdl 并处理返回数据,这里的数据原则上尽可能遵循 AS-IS,如何处理则在于用户。你面临的使用场景即是后者,而不是去更改 ykdl 本身。


title = match1(html, 'Title-head\w*">([^<]+)<')
artist = match1(html, 'Title-anchorName\w*" title="([^"]+)"')
Expand Down