Created
April 21, 2020 16:25
-
-
Save Hootrix/b14927114d707039e25f60f92dd4b275 to your computer and use it in GitHub Desktop.
无用空间音频下载
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
无用空间的音频下载 | |
time:2020-04-22 | |
Author:pang | |
""" | |
# http://www.timeless-world.org//audio-browse-22.html?s1=30 | |
# http://www.timeless-world.org/svideo-browse-17.html?s1=30 | |
import requests,re as regex | |
host = 'http://www.timeless-world.org' | |
mp3_save_path = '~/Desktop' | |
api = '{}/api-article.html?type=audio&s1=30&index=0&size=100'.format(host) | |
re = requests.get(api) | |
content = re.json() | |
# {"error":0,"message":0,"data":{"total":21,"list":[{"id":"135","title":"11\u300a\u7269\u6f14\u901a\u8bba\u300b\u5377\u4e09 \u793e\u4f1a\u54f2\u5b66\u5377\u5bfc\u8bfb","thumb":"","date":"2017-03-30","link":"\/audio-view-135.html"},{"id":"134","title":"10\u300a\u7269\u6f14\u901a\u8bba\u300b\u5377\u4e8c \u7cbe\u795e\u54f2\u5b66\u5377\u5bfc\u8bfb","thumb":"","date":"2017-03-30","link":"\/audio-view-134.html"},{"id":"133","title":"09\u300a\u7269\u6f14\u901a\u8bba\u300b16-09-04\u7b54\u75911","thumb":"","date":"2017-03-30","link":"\/audio-view-133.html"},{"id":"132","title":"08\u300a\u7269\u6f14\u901a\u8bba\u300b\u5377\u4e00 \u81ea\u7136\u54f2\u5b66\u5377\u5bfc\u8bfb","thumb":"","date":"2017-03-30","link":"\/audio-view-132.html"},{"id":"131","title":"07\u5982\u4f55\u8bfb\u4e66","thumb":"","date":"2017-03-30","link":"\/audio-view-131.html"},{"id":"130","title":"06\u300a\u7269\u6f14\u901a\u8bba\u300b16-09-03\u7b54\u75912","thumb":"","date":"2017-03-30","link":"\/audio-view-130.html"},{"id":"129","title":"05\u89e3\u8bfb\u601d\u60f3\u51b3\u5b9a\u4e8b\u5b9e","thumb":"","date":"2017-03-30","link":"\/audio-view-129.html"},{"id":"128","title":"04\u300a\u7269\u6f14\u901a\u8bba\u300b16-09-03\u7b54\u75911","thumb":"","date":"2017-03-30","link":"\/audio-view-128.html"},{"id":"127","title":"03\u300a\u7269\u6f14\u901a\u8bba\u300b\u4e09\u70b9\u8f85\u5bfc","thumb":"","date":"2017-03-30","link":"\/audio-view-127.html"},{"id":"125","title":"02\u9488\u5bf9\u5b58\u5728\u8bba\u7684\u7b54\u7591","thumb":"","date":"2017-03-30","link":"\/audio-view-125.html"}]}}) | |
assert 'data' in content and 'list' in content['data'] | |
for i in content['data']['list']: | |
title = i['title'] | |
page_url = host+i['link'] | |
page_re = requests.get(page_url) | |
page = page_re.text | |
mp3_find = regex.search('src="(.*?\.mp3)"',page,regex.I) | |
if mp3_find.group(1): | |
dl = requests.get(host+mp3_find.group(1)) | |
mp3_dl_path = '{}/{}.mp3'.format(mp3_save_path,title) | |
with open(mp3_dl_path,'w+b') as _f: | |
_f.write(dl.content) | |
print('download complete {}'.format(title)) | |
else: | |
print('break {}'.format(title)) | |
""" | |
$ python wuyong.py | |
download complete 21《物演通论》五印一纲之数模总纲 | |
download complete 20《物演通论》五印一纲之伪在危在 | |
download complete 19《物演通论》五印一纲之分化耦合 | |
download complete 18《物演通论》五印一纲之有限区间 | |
download complete 17《物演通论》五印一纲之代偿位相 | |
download complete 16《物演通论》五印一纲之弱演变量 | |
download complete 15澄明《物演通论》思想的三个基础出发点 | |
download complete 14王东岳先生《宇宙观的意义》哲学讲座 | |
download complete 13《物演通论》答疑会结束语 | |
download complete 12《物演通论》16-09-04答疑2 | |
download complete 11《物演通论》卷三 社会哲学卷导读 | |
download complete 10《物演通论》卷二 精神哲学卷导读 | |
download complete 09《物演通论》16-09-04答疑1 | |
download complete 08《物演通论》卷一 自然哲学卷导读 | |
download complete 07如何读书 | |
download complete 06《物演通论》16-09-03答疑2 | |
download complete 05解读思想决定事实 | |
download complete 04《物演通论》16-09-03答疑1 | |
download complete 03《物演通论》三点辅导 | |
download complete 02针对存在论的答疑 | |
download complete 01存在论的意义 | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment