Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
Y
yt-dlp
管理
动态
成员
标记
计划
议题
议题看板
里程碑
Wiki
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
构建
流水线
作业
流水线计划
产物
部署
发布
软件包库
容器镜像库
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
Tin Lu
yt-dlp
提交
e9efb99f
未验证
提交
e9efb99f
编辑于
3年前
作者:
Sonic
提交者:
GitHub
3年前
浏览文件
操作
下载
补丁
差异文件
[dropout] Add extractor (#2045)
Authored-by: TwoThousandHedgehogs, pukkandan
上级
a709d873
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
yt_dlp/extractor/dropout.py
+212
-0
212 个添加, 0 个删除
yt_dlp/extractor/dropout.py
yt_dlp/extractor/extractors.py
+4
-0
4 个添加, 0 个删除
yt_dlp/extractor/extractors.py
有
216 个添加
和
0 个删除
yt_dlp/extractor/dropout.py
0 → 100644
+
212
−
0
浏览文件 @
e9efb99f
# coding: utf-8
from
.common
import
InfoExtractor
from
.vimeo
import
VHXEmbedIE
from
..utils
import
(
clean_html
,
ExtractorError
,
get_element_by_class
,
get_element_by_id
,
get_elements_by_class
,
int_or_none
,
join_nonempty
,
unified_strdate
,
urlencode_postdata
,
)
class
DropoutIE
(
InfoExtractor
):
_LOGIN_URL
=
'
https://www.dropout.tv/login
'
_NETRC_MACHINE
=
'
dropout
'
_VALID_URL
=
r
'
https?://(?:www\.)?dropout\.tv/(?:[^/]+/)*videos/(?P<id>[^/]+)/?$
'
_TESTS
=
[
{
'
url
'
:
'
https://www.dropout.tv/game-changer/season:2/videos/yes-or-no
'
,
'
note
'
:
'
Episode in a series
'
,
'
md5
'
:
'
5e000fdfd8d8fa46ff40456f1c2af04a
'
,
'
info_dict
'
:
{
'
id
'
:
'
738153
'
,
'
display_id
'
:
'
yes-or-no
'
,
'
ext
'
:
'
mp4
'
,
'
title
'
:
'
Yes or No
'
,
'
description
'
:
'
Ally, Brennan, and Zac are asked a simple question, but is there a correct answer?
'
,
'
release_date
'
:
'
20200508
'
,
'
thumbnail
'
:
'
https://vhx.imgix.net/chuncensoredstaging/assets/351e3f24-c4a3-459a-8b79-dc80f1e5b7fd.jpg
'
,
'
series
'
:
'
Game Changer
'
,
'
season_number
'
:
2
,
'
season
'
:
'
Season 2
'
,
'
episode_number
'
:
6
,
'
episode
'
:
'
Yes or No
'
,
'
duration
'
:
1180
,
'
uploader_id
'
:
'
user80538407
'
,
'
uploader_url
'
:
'
https://vimeo.com/user80538407
'
,
'
uploader
'
:
'
OTT Videos
'
},
'
expected_warnings
'
:
[
'
Ignoring subtitle tracks found in the HLS manifest
'
]
},
{
'
url
'
:
'
https://www.dropout.tv/dimension-20-fantasy-high/season:1/videos/episode-1
'
,
'
note
'
:
'
Episode in a series (missing release_date)
'
,
'
md5
'
:
'
712caf7c191f1c47c8f1879520c2fa5c
'
,
'
info_dict
'
:
{
'
id
'
:
'
320562
'
,
'
display_id
'
:
'
episode-1
'
,
'
ext
'
:
'
mp4
'
,
'
title
'
:
'
The Beginning Begins
'
,
'
description
'
:
'
The cast introduces their PCs, including a neurotic elf, a goblin PI, and a corn-worshipping cleric.
'
,
'
thumbnail
'
:
'
https://vhx.imgix.net/chuncensoredstaging/assets/4421ed0d-f630-4c88-9004-5251b2b8adfa.jpg
'
,
'
series
'
:
'
Dimension 20: Fantasy High
'
,
'
season_number
'
:
1
,
'
season
'
:
'
Season 1
'
,
'
episode_number
'
:
1
,
'
episode
'
:
'
The Beginning Begins
'
,
'
duration
'
:
6838
,
'
uploader_id
'
:
'
user80538407
'
,
'
uploader_url
'
:
'
https://vimeo.com/user80538407
'
,
'
uploader
'
:
'
OTT Videos
'
},
'
expected_warnings
'
:
[
'
Ignoring subtitle tracks found in the HLS manifest
'
]
},
{
'
url
'
:
'
https://www.dropout.tv/videos/misfits-magic-holiday-special
'
,
'
note
'
:
'
Episode not in a series
'
,
'
md5
'
:
'
c30fa18999c5880d156339f13c953a26
'
,
'
info_dict
'
:
{
'
id
'
:
'
1915774
'
,
'
display_id
'
:
'
misfits-magic-holiday-special
'
,
'
ext
'
:
'
mp4
'
,
'
title
'
:
'
Misfits & Magic Holiday Special
'
,
'
description
'
:
'
The magical misfits spend Christmas break at Gowpenny, with an unwelcome visitor.
'
,
'
release_date
'
:
'
20211215
'
,
'
thumbnail
'
:
'
https://vhx.imgix.net/chuncensoredstaging/assets/d91ea8a6-b250-42ed-907e-b30fb1c65176-8e24b8e5.jpg
'
,
'
duration
'
:
11698
,
'
uploader_id
'
:
'
user80538407
'
,
'
uploader_url
'
:
'
https://vimeo.com/user80538407
'
,
'
uploader
'
:
'
OTT Videos
'
},
'
expected_warnings
'
:
[
'
Ignoring subtitle tracks found in the HLS manifest
'
]
}
]
def
_get_authenticity_token
(
self
,
display_id
):
signin_page
=
self
.
_download_webpage
(
self
.
_LOGIN_URL
,
display_id
,
note
=
'
Getting authenticity token
'
)
return
self
.
_html_search_regex
(
r
'
name=[
"
\']authenticity_token[
"
\'] value=[
"
\'](.+?)[
"
\']
'
,
signin_page
,
'
authenticity_token
'
)
def
_login
(
self
,
display_id
):
username
,
password
=
self
.
_get_login_info
()
if
not
(
username
and
password
):
self
.
raise_login_required
(
method
=
'
password
'
)
response
=
self
.
_download_webpage
(
self
.
_LOGIN_URL
,
display_id
,
note
=
'
Logging in
'
,
data
=
urlencode_postdata
({
'
email
'
:
username
,
'
password
'
:
password
,
'
authenticity_token
'
:
self
.
_get_authenticity_token
(
display_id
),
'
utf8
'
:
True
}))
user_has_subscription
=
self
.
_search_regex
(
r
'
user_has_subscription:\s*[
"
\'](.+?)[
"
\']
'
,
response
,
'
subscription status
'
,
default
=
'
none
'
)
if
user_has_subscription
.
lower
()
==
'
true
'
:
return
response
elif
user_has_subscription
.
lower
()
==
'
false
'
:
raise
ExtractorError
(
'
Account is not subscribed
'
)
else
:
raise
ExtractorError
(
'
Incorrect username/password
'
)
def
_real_extract
(
self
,
url
):
display_id
=
self
.
_match_id
(
url
)
try
:
self
.
_login
(
display_id
)
webpage
=
self
.
_download_webpage
(
url
,
display_id
,
note
=
'
Downloading video webpage
'
)
finally
:
self
.
_download_webpage
(
'
https://www.dropout.tv/logout
'
,
display_id
,
note
=
'
Logging out
'
)
embed_url
=
self
.
_search_regex
(
r
'
embed_url:\s*[
"
\'](.+?)[
"
\']
'
,
webpage
,
'
embed url
'
)
thumbnail
=
self
.
_og_search_thumbnail
(
webpage
)
watch_info
=
get_element_by_id
(
'
watch-info
'
,
webpage
)
or
''
title
=
clean_html
(
get_element_by_class
(
'
video-title
'
,
watch_info
))
season_episode
=
get_element_by_class
(
'
site-font-secondary-color
'
,
get_element_by_class
(
'
text
'
,
watch_info
))
episode_number
=
int_or_none
(
self
.
_search_regex
(
r
'
Episode (\d+)
'
,
season_episode
or
''
,
'
episode
'
,
default
=
None
))
return
{
'
_type
'
:
'
url_transparent
'
,
'
ie_key
'
:
VHXEmbedIE
.
ie_key
(),
'
url
'
:
embed_url
,
'
id
'
:
self
.
_search_regex
(
r
'
embed.vhx.tv/videos/(.+?)\?
'
,
embed_url
,
'
id
'
),
'
display_id
'
:
display_id
,
'
title
'
:
title
,
'
description
'
:
self
.
_html_search_meta
(
'
description
'
,
webpage
,
fatal
=
False
),
'
thumbnail
'
:
thumbnail
.
split
(
'
?
'
)[
0
]
if
thumbnail
else
None
,
# Ignore crop/downscale
'
series
'
:
clean_html
(
get_element_by_class
(
'
series-title
'
,
watch_info
)),
'
episode_number
'
:
episode_number
,
'
episode
'
:
title
if
episode_number
else
None
,
'
season_number
'
:
int_or_none
(
self
.
_search_regex
(
r
'
Season (\d+),
'
,
season_episode
or
''
,
'
season
'
,
default
=
None
)),
'
release_date
'
:
unified_strdate
(
self
.
_search_regex
(
r
'
data-meta-field-name=[
"
\']release_dates[
"
\'] data-meta-field-value=[
"
\'](.+?)[
"
\']
'
,
watch_info
,
'
release date
'
,
default
=
None
)),
}
class
DropoutSeasonIE
(
InfoExtractor
):
_VALID_URL
=
r
'
https?://(?:www\.)?dropout\.tv/(?P<id>[^\/$&?#]+)(?:/?$|/season:[0-9]+/?$)
'
_TESTS
=
[
{
'
url
'
:
'
https://www.dropout.tv/dimension-20-fantasy-high/season:1
'
,
'
note
'
:
'
Multi-season series with the season in the url
'
,
'
playlist_count
'
:
17
,
'
info_dict
'
:
{
'
id
'
:
'
dimension-20-fantasy-high-season-1
'
,
'
title
'
:
'
Dimension 20 Fantasy High - Season 1
'
}
},
{
'
url
'
:
'
https://www.dropout.tv/dimension-20-fantasy-high
'
,
'
note
'
:
'
Multi-season series with the season not in the url
'
,
'
playlist_count
'
:
17
,
'
info_dict
'
:
{
'
id
'
:
'
dimension-20-fantasy-high-season-1
'
,
'
title
'
:
'
Dimension 20 Fantasy High - Season 1
'
}
},
{
'
url
'
:
'
https://www.dropout.tv/dimension-20-shriek-week
'
,
'
note
'
:
'
Single-season series
'
,
'
playlist_count
'
:
4
,
'
info_dict
'
:
{
'
id
'
:
'
dimension-20-shriek-week-season-1
'
,
'
title
'
:
'
Dimension 20 Shriek Week - Season 1
'
}
}
]
def
_real_extract
(
self
,
url
):
season_id
=
self
.
_match_id
(
url
)
season_title
=
season_id
.
replace
(
'
-
'
,
'
'
).
title
()
webpage
=
self
.
_download_webpage
(
url
,
season_id
)
entries
=
[
self
.
url_result
(
url
=
self
.
_search_regex
(
r
'
<a href=[
"
\'](.+?)[
"
\'] class=[
"
\']browse-item-link[
"
\']
'
,
item
,
'
item_url
'
),
ie
=
DropoutIE
.
ie_key
()
)
for
item
in
get_elements_by_class
(
'
js-collection-item
'
,
webpage
)
]
seasons
=
(
get_element_by_class
(
'
select-dropdown-wrapper
'
,
webpage
)
or
''
).
strip
().
replace
(
'
\n
'
,
''
)
current_season
=
self
.
_search_regex
(
r
'
<option[^>]+selected>([^<]+)</option>
'
,
seasons
,
'
current_season
'
,
default
=
''
).
strip
()
return
{
'
_type
'
:
'
playlist
'
,
'
id
'
:
join_nonempty
(
season_id
,
current_season
.
lower
().
replace
(
'
'
,
'
-
'
)),
'
title
'
:
join_nonempty
(
season_title
,
current_season
,
delim
=
'
-
'
),
'
entries
'
:
entries
}
This diff is collapsed.
点击以展开。
yt_dlp/extractor/extractors.py
+
4
−
0
浏览文件 @
e9efb99f
...
...
@@ -385,6 +385,10 @@ from .disney import DisneyIE
from
.dispeak
import
DigitallySpeakingIE
from
.doodstream
import
DoodStreamIE
from
.dropbox
import
DropboxIE
from
.dropout
import
(
DropoutSeasonIE
,
DropoutIE
)
from
.dw
import
(
DWIE
,
DWArticleIE
,
...
...
This diff is collapsed.
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录