Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XianxinMao
Yt Dlp
提交
492272fe
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,发现更多精彩内容 >>
未验证
提交
492272fe
编写于
4月 28, 2022
作者:
P
pukkandan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
`--match-filter -` to interactively ask for each video
上级
59f943cd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
7 deletion
+28
-7
README.md
README.md
+3
-1
yt_dlp/YoutubeDL.py
yt_dlp/YoutubeDL.py
+14
-1
yt_dlp/minicurses.py
yt_dlp/minicurses.py
+1
-0
yt_dlp/options.py
yt_dlp/options.py
+2
-1
yt_dlp/utils.py
yt_dlp/utils.py
+8
-4
未找到文件。
README.md
浏览文件 @
492272fe
...
...
@@ -451,7 +451,9 @@ ## Video Selection:
those that have a like count more than 100
(or the like field is not available) and
also has a description that contains the
phrase "cats & dogs" (ignoring case)
phrase "cats & dogs" (ignoring case). Use
"--match-filter -" to interactively ask
whether to download each video
--no-match-filter Do not use generic video filter (default)
--no-playlist Download only the video, if the URL refers
to a video and a playlist
...
...
yt_dlp/YoutubeDL.py
浏览文件 @
492272fe
...
...
@@ -413,6 +413,8 @@ class YoutubeDL:
every video.
If it returns a message, the video is ignored.
If it returns None, the video is downloaded.
If it returns utils.NO_DEFAULT, the user is interactively
asked whether to download the video.
match_filter_func in utils.py is one example for this.
no_color: Do not emit color codes in output.
geo_bypass: Bypass geographic restriction via faking X-Forwarded-For
...
...
@@ -878,6 +880,7 @@ def trouble(self, message=None, tb=None, is_error=True):
Styles
=
Namespace
(
HEADERS
=
'yellow'
,
EMPHASIS
=
'light blue'
,
FILENAME
=
'green'
,
ID
=
'green'
,
DELIM
=
'blue'
,
ERROR
=
'red'
,
...
...
@@ -1303,7 +1306,17 @@ def check_filter():
except
TypeError
:
# For backward compatibility
ret
=
None
if
incomplete
else
match_filter
(
info_dict
)
if
ret
is
not
None
:
if
ret
is
NO_DEFAULT
:
while
True
:
filename
=
self
.
_format_screen
(
self
.
prepare_filename
(
info_dict
),
self
.
Styles
.
FILENAME
)
reply
=
input
(
self
.
_format_screen
(
f
'Download "
{
filename
}
"? (Y/n): '
,
self
.
Styles
.
EMPHASIS
)).
lower
().
strip
()
if
reply
in
{
'y'
,
''
}:
return
None
elif
reply
==
'n'
:
return
f
'Skipping
{
video_title
}
'
return
True
elif
ret
is
not
None
:
return
ret
return
None
...
...
yt_dlp/minicurses.py
浏览文件 @
492272fe
...
...
@@ -69,6 +69,7 @@ def format_text(text, f):
raise
SyntaxError
(
f
'Invalid format
{
" "
.
join
(
tokens
)
!
r
}
in
{
f
!
r
}
'
)
if
fg_color
or
bg_color
:
text
=
text
.
replace
(
CONTROL_SEQUENCES
[
'RESET'
],
f
'
{
fg_color
}{
bg_color
}
'
)
return
f
'
{
fg_color
}{
bg_color
}{
text
}{
CONTROL_SEQUENCES
[
"RESET"
]
}
'
else
:
return
text
...
...
yt_dlp/options.py
浏览文件 @
492272fe
...
...
@@ -471,7 +471,8 @@ def _dict_from_options_callback(
'!is_live --match-filter "like_count>?100 & description~=
\'
(?i)
\\
bcats
\\
& dogs
\\
b
\'
" '
'matches only videos that are not live OR those that have a like count more than 100 '
'(or the like field is not available) and also has a description '
'that contains the phrase "cats & dogs" (ignoring case)'
))
'that contains the phrase "cats & dogs" (ignoring case). '
'Use "--match-filter -" to interactively ask whether to download each video'
))
selection
.
add_option
(
'--no-match-filter'
,
metavar
=
'FILTER'
,
dest
=
'match_filter'
,
action
=
'store_const'
,
const
=
None
,
...
...
yt_dlp/utils.py
浏览文件 @
492272fe
...
...
@@ -3407,11 +3407,15 @@ def match_str(filter_str, dct, incomplete=False):
def
match_filter_func
(
filters
):
if
not
filters
:
return
None
filters
=
variadic
(
filters
)
filters
=
set
(
variadic
(
filters
)
)
def
_match_func
(
info_dict
,
*
args
,
**
kwargs
):
if
any
(
match_str
(
f
,
info_dict
,
*
args
,
**
kwargs
)
for
f
in
filters
):
return
None
interactive
=
'-'
in
filters
if
interactive
:
filters
.
remove
(
'-'
)
def
_match_func
(
info_dict
,
incomplete
=
False
):
if
not
filters
or
any
(
match_str
(
f
,
info_dict
,
incomplete
)
for
f
in
filters
):
return
NO_DEFAULT
if
interactive
and
not
incomplete
else
None
else
:
video_title
=
info_dict
.
get
(
'title'
)
or
info_dict
.
get
(
'id'
)
or
'video'
filter_str
=
') | ('
.
join
(
map
(
str
.
strip
,
filters
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录