Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XianxinMao
Yt Dlp
提交
4877f905
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,发现更多精彩内容 >>
未验证
提交
4877f905
编写于
4月 28, 2022
作者:
G
Giedrius Statkevičius
提交者:
GitHub
4月 28, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lrt] Support livestreams (#3555)
Authored by: GiedriusS
上级
a076c1f9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
52 addition
and
10 deletion
+52
-10
yt_dlp/extractor/extractors.py
yt_dlp/extractor/extractors.py
+5
-2
yt_dlp/extractor/lrt.py
yt_dlp/extractor/lrt.py
+47
-8
未找到文件。
yt_dlp/extractor/extractors.py
浏览文件 @
4877f905
...
...
@@ -814,7 +814,10 @@
)
from
.localnews8
import
LocalNews8IE
from
.lovehomeporn
import
LoveHomePornIE
from
.lrt
import
LRTIE
from
.lrt
import
(
LRTVODIE
,
LRTStreamIE
)
from
.lynda
import
(
LyndaIE
,
LyndaCourseIE
...
...
yt_dlp/extractor/lrt.py
浏览文件 @
4877f905
...
...
@@ -2,16 +2,58 @@
from
..utils
import
(
clean_html
,
merge_dicts
,
traverse_obj
,
url_or_none
,
)
class
LRTIE
(
InfoExtractor
):
IE_NAME
=
'lrt.lt'
class
LRTBaseIE
(
InfoExtractor
):
def
_extract_js_var
(
self
,
webpage
,
var_name
,
default
=
None
):
return
self
.
_search_regex
(
fr
'
{
var_name
}
\s*=\s*(["\'])((?:(?!\1).)+)\1'
,
webpage
,
var_name
.
replace
(
'_'
,
' '
),
default
,
group
=
2
)
class
LRTStreamIE
(
LRTBaseIE
):
_VALID_URL
=
r
'https?://(?:www\.)?lrt\.lt/mediateka/tiesiogiai/(?P<id>[\w-]+)'
_TESTS
=
[{
'url'
:
'https://www.lrt.lt/mediateka/tiesiogiai/lrt-opus'
,
'info_dict'
:
{
'id'
:
'lrt-opus'
,
'live_status'
:
'is_live'
,
'title'
:
're:^LRT Opus.+$'
,
'ext'
:
'mp4'
}
}]
def
_real_extract
(
self
,
url
):
video_id
=
self
.
_match_id
(
url
)
webpage
=
self
.
_download_webpage
(
url
,
video_id
)
streams_data
=
self
.
_download_json
(
self
.
_extract_js_var
(
webpage
,
'tokenURL'
),
video_id
)
formats
,
subtitles
=
[],
{}
for
stream_url
in
traverse_obj
(
streams_data
,
(
'response'
,
'data'
,
lambda
k
,
_
:
k
.
startswith
(
'content'
)),
expected_type
=
url_or_none
):
fmts
,
subs
=
self
.
_extract_m3u8_formats_and_subtitles
(
stream_url
,
video_id
,
'mp4'
,
m3u8_id
=
'hls'
,
live
=
True
)
formats
.
extend
(
fmts
)
subtitles
=
self
.
_merge_subtitles
(
subtitles
,
subs
)
self
.
_sort_formats
(
formats
)
stream_title
=
self
.
_extract_js_var
(
webpage
,
'video_title'
,
'LRT'
)
return
{
'id'
:
video_id
,
'formats'
:
formats
,
'subtitles'
:
subtitles
,
'is_live'
:
True
,
'title'
:
f
'
{
self
.
_og_search_title
(
webpage
)
}
-
{
stream_title
}
'
}
class
LRTVODIE
(
LRTBaseIE
):
_VALID_URL
=
r
'https?://(?:www\.)?lrt\.lt(?P<path>/mediateka/irasas/(?P<id>[0-9]+))'
_TESTS
=
[{
# m3u8 download
'url'
:
'https://www.lrt.lt/mediateka/irasas/2000127261/greita-ir-gardu-sicilijos-ikvepta-klasikiniu-makaronu-su-baklazanais-vakariene'
,
'md5'
:
'85cb2bb530f31d91a9c65b479516ade4'
,
'info_dict'
:
{
'id'
:
'2000127261'
,
'ext'
:
'mp4'
,
...
...
@@ -20,6 +62,8 @@ class LRTIE(InfoExtractor):
'duration'
:
3035
,
'timestamp'
:
1604079000
,
'upload_date'
:
'20201030'
,
'tags'
:
[
'LRT TELEVIZIJA'
,
'Beatos virtuvė'
,
'Beata Nicholson'
,
'Makaronai'
,
'Baklažanai'
,
'Vakarienė'
,
'Receptas'
],
'thumbnail'
:
'https://www.lrt.lt/img/2020/10/30/764041-126478-1287x836.jpg'
},
},
{
# direct mp3 download
...
...
@@ -36,11 +80,6 @@ class LRTIE(InfoExtractor):
},
}]
def
_extract_js_var
(
self
,
webpage
,
var_name
,
default
):
return
self
.
_search_regex
(
r
'%s\s*=\s*(["\'])((?:(?!\1).)+)\1'
%
var_name
,
webpage
,
var_name
.
replace
(
'_'
,
' '
),
default
,
group
=
2
)
def
_real_extract
(
self
,
url
):
path
,
video_id
=
self
.
_match_valid_url
(
url
).
groups
()
webpage
=
self
.
_download_webpage
(
url
,
video_id
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录