Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Added Prison Break Scrapper
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
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() |