Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XianxinMao
Yt Dlp
提交
4bb6b02f
Y
Yt Dlp
项目概览
XianxinMao
/
Yt Dlp
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
4bb6b02f
编写于
7月 08, 2021
作者:
P
pukkandan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve `extractor_args` parsing
上级
b5ac45b1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
15 deletion
+29
-15
Changelog.md
Changelog.md
+2
-2
yt_dlp/extractor/common.py
yt_dlp/extractor/common.py
+11
-2
yt_dlp/extractor/funimation.py
yt_dlp/extractor/funimation.py
+2
-2
yt_dlp/extractor/youtube.py
yt_dlp/extractor/youtube.py
+6
-6
yt_dlp/options.py
yt_dlp/options.py
+8
-3
未找到文件。
Changelog.md
浏览文件 @
4bb6b02f
...
@@ -22,9 +22,9 @@ # Instuctions for creating release
...
@@ -22,9 +22,9 @@ # Instuctions for creating release
### 2021.07.07
### 2021.07.07
*
Merge youtube-dl: Upto
[
commit/a803582
](
https://github.com/ytdl-org/youtube-dl/commit/a8035827177d6b59aca03bd717acb6a9bdd75ada
)
*
Merge youtube-dl: Upto
[
commit/a803582
](
https://github.com/ytdl-org/youtube-dl/commit/a8035827177d6b59aca03bd717acb6a9bdd75ada
)
*
Add
`--extractor-args`
to pass
extractor-specific arguments
*
Add
`--extractor-args`
to pass
some extractor-specific arguments. See
[
readme
](
https://github.com/yt-dlp/yt-dlp#extractor-arguments
)
*
Add extractor option
`skip`
for
`youtube`
. Eg:
`--extractor-args youtube:skip=hls,dash`
*
Add extractor option
`skip`
for
`youtube`
. Eg:
`--extractor-args youtube:skip=hls,dash`
*
Deprecates
--youtube-skip-dash-manifest, --youtube-skip-hls-manifest, --youtube-include-dash-manifest, --youtube-include-hls-manifest
*
Deprecates
`--youtube-skip-dash-manifest`
,
`--youtube-skip-hls-manifest`
,
`--youtube-include-dash-manifest`
,
`--youtube-include-hls-manifest`
*
Allow
`--list...`
options to work with
`--print`
,
`--quiet`
and other
`--list...`
options
*
Allow
`--list...`
options to work with
`--print`
,
`--quiet`
and other
`--list...`
options
*
[
youtube] Use `player` API for additional video extraction requests by [colethedj
](
https://github.com/colethedj
)
*
[
youtube] Use `player` API for additional video extraction requests by [colethedj
](
https://github.com/colethedj
)
*
**Fixes youtube premium music**
(format 141) extraction
*
**Fixes youtube premium music**
(format 141) extraction
...
...
yt_dlp/extractor/common.py
浏览文件 @
4bb6b02f
...
@@ -3498,9 +3498,18 @@ def _availability(is_private=None, needs_premium=None, needs_subscription=None,
...
@@ -3498,9 +3498,18 @@ def _availability(is_private=None, needs_premium=None, needs_subscription=None,
else
'public'
if
all_known
else
'public'
if
all_known
else
None
)
else
None
)
def
_configuration_arg
(
self
,
key
):
def
_configuration_arg
(
self
,
key
,
default
=
NO_DEFAULT
,
casesense
=
False
):
return
traverse_obj
(
'''
@returns A list of values for the extractor argument given by "key"
or "default" if no such key is present
@param default The default value to return when the key is not present (default: [])
@param casesense When false, the values are converted to lower case
'''
val
=
traverse_obj
(
self
.
_downloader
.
params
,
(
'extractor_args'
,
self
.
ie_key
().
lower
(),
key
))
self
.
_downloader
.
params
,
(
'extractor_args'
,
self
.
ie_key
().
lower
(),
key
))
if
val
is
None
:
return
[]
if
default
is
NO_DEFAULT
else
default
return
list
(
val
)
if
casesense
else
[
x
.
lower
()
for
x
in
val
]
class
SearchInfoExtractor
(
InfoExtractor
):
class
SearchInfoExtractor
(
InfoExtractor
):
...
...
yt_dlp/extractor/funimation.py
浏览文件 @
4bb6b02f
...
@@ -186,8 +186,8 @@ def _real_extract(self, url):
...
@@ -186,8 +186,8 @@ def _real_extract(self, url):
for
lang
,
version
,
fmt
in
self
.
_get_experiences
(
episode
):
for
lang
,
version
,
fmt
in
self
.
_get_experiences
(
episode
):
experience_id
=
str
(
fmt
[
'experienceId'
])
experience_id
=
str
(
fmt
[
'experienceId'
])
if
(
only_initial_experience
and
experience_id
!=
initial_experience_id
if
(
only_initial_experience
and
experience_id
!=
initial_experience_id
or
requested_languages
and
lang
not
in
requested_languages
or
requested_languages
and
lang
.
lower
()
not
in
requested_languages
or
requested_versions
and
version
not
in
requested_versions
):
or
requested_versions
and
version
.
lower
()
not
in
requested_versions
):
continue
continue
thumbnails
.
append
({
'url'
:
fmt
.
get
(
'poster'
)})
thumbnails
.
append
({
'url'
:
fmt
.
get
(
'poster'
)})
duration
=
max
(
duration
,
fmt
.
get
(
'duration'
,
0
))
duration
=
max
(
duration
,
fmt
.
get
(
'duration'
,
0
))
...
...
yt_dlp/extractor/youtube.py
浏览文件 @
4bb6b02f
...
@@ -2207,11 +2207,11 @@ def _real_extract(self, url):
...
@@ -2207,11 +2207,11 @@ def _real_extract(self, url):
player_url
=
self
.
_extract_player_url
(
ytcfg
,
webpage
)
player_url
=
self
.
_extract_player_url
(
ytcfg
,
webpage
)
player_client
=
try_get
(
self
.
_configuration_arg
(
'player_client'
),
lambda
x
:
x
[
0
],
str
)
or
''
player_client
=
(
self
.
_configuration_arg
(
'player_client'
)
or
[
''
])[
0
]
if
player_client
.
upper
()
not
in
(
'WEB'
,
'ANDROID
'
):
if
player_client
not
in
(
'web'
,
'android'
,
'
'
):
player_client
=
'WEB'
self
.
report_warning
(
f
'Invalid player_client
{
player_client
}
given. Falling back to WEB'
)
force_mobile_client
=
player_client
.
upper
()
==
'ANDROID
'
force_mobile_client
=
player_client
==
'android
'
player_skip
=
self
.
_configuration_arg
(
'player_skip'
)
or
[]
player_skip
=
self
.
_configuration_arg
(
'player_skip'
)
def
get_text
(
x
):
def
get_text
(
x
):
if
not
x
:
if
not
x
:
...
@@ -2489,7 +2489,7 @@ def feed_entry(name):
...
@@ -2489,7 +2489,7 @@ def feed_entry(name):
dct
[
'container'
]
=
dct
[
'ext'
]
+
'_dash'
dct
[
'container'
]
=
dct
[
'ext'
]
+
'_dash'
formats
.
append
(
dct
)
formats
.
append
(
dct
)
skip_manifests
=
self
.
_configuration_arg
(
'skip'
)
or
[]
skip_manifests
=
self
.
_configuration_arg
(
'skip'
)
get_dash
=
'dash'
not
in
skip_manifests
and
self
.
get_param
(
'youtube_include_dash_manifest'
,
True
)
get_dash
=
'dash'
not
in
skip_manifests
and
self
.
get_param
(
'youtube_include_dash_manifest'
,
True
)
get_hls
=
'hls'
not
in
skip_manifests
and
self
.
get_param
(
'youtube_include_hls_manifest'
,
True
)
get_hls
=
'hls'
not
in
skip_manifests
and
self
.
get_param
(
'youtube_include_hls_manifest'
,
True
)
...
...
yt_dlp/options.py
浏览文件 @
4bb6b02f
...
@@ -137,7 +137,11 @@ def _dict_from_options_callback(
...
@@ -137,7 +137,11 @@ def _dict_from_options_callback(
else
:
else
:
raise
optparse
.
OptionValueError
(
raise
optparse
.
OptionValueError
(
'wrong %s formatting; it should be %s, not "%s"'
%
(
opt_str
,
option
.
metavar
,
value
))
'wrong %s formatting; it should be %s, not "%s"'
%
(
opt_str
,
option
.
metavar
,
value
))
val
=
process
(
val
)
if
callable
(
process
)
else
val
try
:
val
=
process
(
val
)
if
process
else
val
except
Exception
as
err
:
raise
optparse
.
OptionValueError
(
'wrong %s formatting; %s'
%
(
opt_str
,
err
))
for
key
in
keys
:
for
key
in
keys
:
out_dict
[
key
]
=
val
out_dict
[
key
]
=
val
...
@@ -1344,6 +1348,7 @@ def _dict_from_options_callback(
...
@@ -1344,6 +1348,7 @@ def _dict_from_options_callback(
'--no-hls-split-discontinuity'
,
'--no-hls-split-discontinuity'
,
dest
=
'hls_split_discontinuity'
,
action
=
'store_false'
,
dest
=
'hls_split_discontinuity'
,
action
=
'store_false'
,
help
=
'Do not split HLS playlists to different formats at discontinuities such as ad breaks (default)'
)
help
=
'Do not split HLS playlists to different formats at discontinuities such as ad breaks (default)'
)
_extractor_arg_parser
=
lambda
key
,
vals
=
''
:
(
key
.
strip
().
lower
(),
[
val
.
strip
()
for
val
in
vals
.
split
(
','
)])
extractor
.
add_option
(
extractor
.
add_option
(
'--extractor-args'
,
'--extractor-args'
,
metavar
=
'KEY:ARGS'
,
dest
=
'extractor_args'
,
default
=
{},
type
=
'str'
,
metavar
=
'KEY:ARGS'
,
dest
=
'extractor_args'
,
default
=
{},
type
=
'str'
,
...
@@ -1351,11 +1356,11 @@ def _dict_from_options_callback(
...
@@ -1351,11 +1356,11 @@ def _dict_from_options_callback(
callback_kwargs
=
{
callback_kwargs
=
{
'multiple_keys'
:
False
,
'multiple_keys'
:
False
,
'process'
:
lambda
val
:
dict
(
'process'
:
lambda
val
:
dict
(
(
lambda
x
:
(
x
[
0
],
x
[
1
].
split
(
','
)))(
arg
.
split
(
'='
,
1
)
+
[
''
,
''
]
)
for
arg
in
val
.
split
(
';'
))
_extractor_arg_parser
(
*
arg
.
split
(
'='
,
1
)
)
for
arg
in
val
.
split
(
';'
))
},
},
help
=
(
help
=
(
'Pass these arguments to the extractor. See "EXTRACTOR ARGUMENTS" for details. '
'Pass these arguments to the extractor. See "EXTRACTOR ARGUMENTS" for details. '
'You can use this option multiple times to give
different arguments to
different extractors'
))
'You can use this option multiple times to give
arguments for
different extractors'
))
extractor
.
add_option
(
extractor
.
add_option
(
'--youtube-include-dash-manifest'
,
'--no-youtube-skip-dash-manifest'
,
'--youtube-include-dash-manifest'
,
'--no-youtube-skip-dash-manifest'
,
action
=
'store_true'
,
dest
=
'youtube_include_dash_manifest'
,
default
=
True
,
action
=
'store_true'
,
dest
=
'youtube_include_dash_manifest'
,
default
=
True
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录