Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XianxinMao
Yt Dlp
提交
7ea65411
Y
Yt Dlp
项目概览
XianxinMao
/
Yt Dlp
11 个月 前同步成功
通知
27
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
Yt Dlp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7ea65411
编写于
7月 21, 2021
作者:
P
pukkandan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[youtube] Improve extraction of livestream metadata
Modified from and closes #441 Authored by: pukkandan, krichbanana
上级
ae30b840
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
12 deletion
+33
-12
yt_dlp/extractor/youtube.py
yt_dlp/extractor/youtube.py
+33
-12
未找到文件。
yt_dlp/extractor/youtube.py
浏览文件 @
7ea65411
...
...
@@ -43,6 +43,7 @@
parse_codecs
,
parse_count
,
parse_duration
,
parse_iso8601
,
qualities
,
remove_start
,
smuggle_url
,
...
...
@@ -2678,17 +2679,10 @@ def feed_entry(name):
else
:
self
.
to_screen
(
'Downloading just video %s because of --no-playlist'
%
video_id
)
category
=
get_first
(
microformats
,
'category'
)
or
search_meta
(
'genre'
)
channel_id
=
get_first
(
video_details
,
'channelId'
)
\
or
get_first
(
microformats
,
'externalChannelId'
)
\
or
search_meta
(
'channelId'
)
duration
=
int_or_none
(
get_first
(
video_details
,
'lengthSeconds'
)
or
get_first
(
microformats
,
'lengthSeconds'
))
\
or
parse_duration
(
search_meta
(
'duration'
))
live_broadcast_details
=
traverse_obj
(
microformats
,
(...,
'liveBroadcastDetails'
))
is_live
=
get_first
(
video_details
,
'isLive'
)
i
s_upcoming
=
get_first
(
video_details
,
'isUpcoming'
)
owner_profile_url
=
get_first
(
microformats
,
'ownerProfileUrl
'
)
i
f
is_live
is
None
:
is_live
=
get_first
(
live_broadcast_details
,
'isLiveNow
'
)
streaming_data
=
traverse_obj
(
player_responses
,
(...,
'streamingData'
),
default
=
[])
formats
=
list
(
self
.
_extract_formats
(
streaming_data
,
video_id
,
player_url
,
is_live
))
...
...
@@ -2786,6 +2780,29 @@ def feed_entry(name):
thumb
[
'preference'
]
=
(
0
if
'.webp'
in
thumb
[
'url'
]
else
-
1
)
-
(
2
*
i
)
self
.
_remove_duplicate_formats
(
thumbnails
)
category
=
get_first
(
microformats
,
'category'
)
or
search_meta
(
'genre'
)
channel_id
=
str_or_none
(
get_first
(
video_details
,
'channelId'
)
or
get_first
(
microformats
,
'externalChannelId'
)
or
search_meta
(
'channelId'
))
duration
=
int_or_none
(
get_first
(
video_details
,
'lengthSeconds'
)
or
get_first
(
microformats
,
'lengthSeconds'
)
or
parse_duration
(
search_meta
(
'duration'
)))
or
None
owner_profile_url
=
get_first
(
microformats
,
'ownerProfileUrl'
)
live_content
=
get_first
(
video_details
,
'isLiveContent'
)
is_upcoming
=
get_first
(
video_details
,
'isUpcoming'
)
if
is_live
is
None
:
if
is_upcoming
or
live_content
is
False
:
is_live
=
False
if
is_upcoming
is
None
and
(
live_content
or
is_live
):
is_upcoming
=
False
live_starttime
=
parse_iso8601
(
get_first
(
live_broadcast_details
,
'startTimestamp'
))
live_endtime
=
parse_iso8601
(
get_first
(
live_broadcast_details
,
'endTimestamp'
))
if
not
duration
and
live_endtime
and
live_starttime
:
duration
=
live_endtime
-
live_starttime
info
=
{
'id'
:
video_id
,
'title'
:
self
.
_live_title
(
video_title
)
if
is_live
else
video_title
,
...
...
@@ -2812,9 +2829,13 @@ def feed_entry(name):
'webpage_url'
:
webpage_url
,
'categories'
:
[
category
]
if
category
else
None
,
'tags'
:
keywords
,
'is_live'
:
is_live
,
'playable_in_embed'
:
get_first
(
playability_statuses
,
'playableInEmbed'
),
'was_live'
:
get_first
(
video_details
,
'isLiveContent'
),
'is_live'
:
is_live
,
'was_live'
:
(
False
if
is_live
or
is_upcoming
or
live_content
is
False
else
None
if
is_live
is
None
or
is_upcoming
is
None
else
live_content
),
'live_status'
:
'is_upcoming'
if
is_upcoming
else
None
,
# rest will be set by YoutubeDL
'release_timestamp'
:
live_starttime
,
}
pctr
=
get_first
(
player_responses
,
(
'captions'
,
'playerCaptionsTracklistRenderer'
),
expected_type
=
dict
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录