Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
无聊人士张
you-get
提交
5c2bb3fa
Y
you-get
项目概览
无聊人士张
/
you-get
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
you-get
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5c2bb3fa
编写于
12月 15, 2020
作者:
snowyu_lee
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add lrts extractor
上级
b00860e4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
72 addition
and
0 deletion
+72
-0
README.md
README.md
+1
-0
src/you_get/common.py
src/you_get/common.py
+1
-0
src/you_get/extractors/lrts.py
src/you_get/extractors/lrts.py
+70
-0
未找到文件。
README.md
浏览文件 @
5c2bb3fa
...
...
@@ -414,6 +414,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
| 酷我音乐 |
<http://www.kuwo.cn/>
| | |✓|
| 乐视网 |
<http://www.le.com/>
|✓| | |
| 荔枝FM |
<http://www.lizhi.fm/>
| | |✓|
| 懒人听书 |
<http://www.lrts.me/>
| | |✓|
| 秒拍 |
<http://www.miaopai.com/>
|✓| | |
| MioMio弹幕网 |
<http://www.miomio.tv/>
|✓| | |
| MissEvan
<br/>
猫耳FM |
<http://www.missevan.com/>
| | |✓|
...
...
src/you_get/common.py
浏览文件 @
5c2bb3fa
...
...
@@ -76,6 +76,7 @@ SITES = {
'letv'
:
'le'
,
'lizhi'
:
'lizhi'
,
'longzhu'
:
'longzhu'
,
'lrts'
:
'lrts'
,
'magisto'
:
'magisto'
,
'metacafe'
:
'metacafe'
,
'mgtv'
:
'mgtv'
,
...
...
src/you_get/extractors/lrts.py
0 → 100644
浏览文件 @
5c2bb3fa
#!/usr/bin/env python
__all__
=
[
'lrts_download'
]
import
logging
from
..common
import
*
def
lrts_download
(
url
,
output_dir
=
'.'
,
merge
=
True
,
info_only
=
False
,
**
kwargs
):
html
=
get_html
(
url
)
matched
=
re
.
search
(
r
"/book/(\d+)"
,
url
)
if
not
matched
:
raise
AssertionError
(
"not found book number: %s"
%
url
)
book_no
=
matched
.
group
(
1
)
book_title
=
book_no
matched
=
re
.
search
(
r
"<title>(.*)-(.*)</title>"
,
html
)
if
matched
:
book_title
=
matched
.
group
(
1
)
matched
=
re
.
search
(
r
"var totalCount='(\d+)'"
,
html
)
if
not
matched
:
raise
AssertionError
(
"not found total count in html"
)
total_count
=
int
(
matched
.
group
(
1
))
logging
.
debug
(
'total: %s'
%
total_count
)
page_size
=
10
logging
.
debug
(
'total page count: %s'
%
((
total_count
//
page_size
)
+
1
))
headers
=
{
'Referer'
:
url
}
items
=
[]
if
(
total_count
>
page_size
):
for
page
in
range
((
total_count
//
page_size
)
+
1
):
page_url
=
'http://www.lrts.me/ajax/book/%s/%s/%s'
%
(
book_no
,
page
,
page_size
)
response_content
=
json
.
loads
(
post_content
(
page_url
,
headers
))
if
response_content
[
'status'
]
!=
'success'
:
raise
AssertionError
(
"got the page failed: %s"
%
(
page_url
))
data
=
response_content
[
'data'
][
'data'
]
if
data
:
for
i
in
data
:
i
[
'resName'
]
=
parse
.
unquote
(
i
[
'resName'
])
items
.
extend
(
data
)
else
:
break
headers
=
{
'Referer'
:
'http://www.lrts.me/playlist'
}
for
item
in
items
:
i_url
=
'http://www.lrts.me/ajax/path/4/%s/%s'
%
(
item
[
'fatherResId'
],
item
[
'resId'
])
response_content
=
json
.
loads
(
post_content
(
i_url
,
headers
))
# logging.debug(response_content)
if
response_content
[
'status'
]
==
'success'
and
response_content
[
'data'
]:
item
[
'ok'
]
=
True
item
[
'url'
]
=
response_content
[
'data'
]
items
=
list
(
filter
(
lambda
i
:
'ok'
in
i
and
i
[
'ok'
],
items
))
print
(
'Downloading %s: %s count ...'
%
(
book_title
,
len
(
items
)))
for
item
in
items
:
title
=
item
[
'resName'
]
file_url
=
item
[
'url'
]
# if not file_url: continue
_
,
_
,
size
=
url_info
(
file_url
)
print_info
(
site_info
,
title
,
'mp3'
,
size
)
if
not
info_only
:
download_urls
([
file_url
],
title
,
'mp3'
,
size
,
output_dir
,
merge
=
merge
)
site_info
=
"lrts.me"
download
=
lrts_download
download_playlist
=
lrts_download
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录