代码拉取完成,页面将自动刷新
"""
Scrapper for downloading prison break
series from an open server and putting them in a designated folder.
"""
import os
import subprocess
import requests as req
from bs4 import BeautifulSoup as bs
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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。