Last active
August 25, 2018 16:09
-
-
Save zenosxx/138ca5cd3e4e7231505f4c2a1253461f to your computer and use it in GitHub Desktop.
9anime downloader
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
import requests | |
from bs4 import BeautifulSoup | |
#id extractor | |
url = input("Url: ") | |
data = requests.get(url) | |
html = BeautifulSoup(data.text,'html.parser') | |
data = [""] | |
for link in html.find_all('a'): | |
if link.get("data-id") is None: | |
x = None | |
else: | |
data.append(link.get("data-id")) | |
print(int(len(data)/4)) | |
#Link Extractor | |
for i in range(1,int(len(data)/4)): | |
links = open("anime.txt","a") | |
server = "https://www8.9anime.is/ajax/episode/info?ts=1532858400&_=777&id="+data[i]+"&server=33" | |
download = requests.get(server) | |
download= download.json() | |
links.write(download["target"]+"\n") | |
links.close() | |
with open("anime.txt") as f: | |
lines = f.read().splitlines() | |
headers = {"Referer":"https://www.rapidvideo.com"} | |
for j in range(0,len(lines)): | |
idm = open("idm.txt","a") | |
chitoge = requests.get(lines[j],headers=headers,timeout=10) | |
src = BeautifulSoup(chitoge.text,'html.parser') | |
src = src.find("source") | |
idm.write(src.get("src")+"\n") | |
idm.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment