1 Star 0 Fork 0

dzc/Python-1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
prison_break_scrapper.py 828 Bytes
一键复制 编辑 原始数据 按行查看 历史
yashLadha 提交于 2017-09-02 19:18 +08:00 . Added Prison Break Scrapper
"""
Scrapper for downloading prison break
series from an open server and putting them in a designated folder.
"""
import requests as req
from bs4 import BeautifulSoup as bs
import os
import subprocess
BASE_URL = 'http://dl.funsaber.net/serial/Prison%20Break/season%20'
def download_files(links, idx):
for link in links:
subprocess.call([
"aria2c",
"-s",
"16",
"-x",
"16",
"-d",
"season"+str(idx),
link
])
def main():
for i in range(1,5):
r = req.get(BASE_URL+str(i)+'/1080/')
soup = bs(r.text, 'html.parser')
link_ = []
for link in soup.find_all('a'):
if '.mkv' in link.get('href'):
link_.append(BASE_URL+str(i)+'/1080/'+link.get('href'))
if not os.path.exists('season'+str(i)):
os.makedirs('season'+str(i))
download_files(link_, i)
if __name__ == '__main__':
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sdredboy/Python-1.git
git@gitee.com:sdredboy/Python-1.git
sdredboy
Python-1
Python-1
master

搜索帮助