-
Notifications
You must be signed in to change notification settings - Fork 1
/
otaku.py
65 lines (60 loc) · 2.19 KB
/
otaku.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import re # regex //
import requests
from bs4 import BeautifulSoup as bs
r = requests.Session()
def search(katakunci):
url = f"https://otakudesu.moe/?s={katakunci}&post_type=anime"
req = r.get(url)
parsing = bs(req.text,"html.parser")
allAnime = parsing.find("div",attrs={"class":"page"}).findAll("li",attrs={"style":"list-style:none;"})
nomor = 1
list_url = []
for anime in allAnime:
judul = anime.find("h2").find("a").text
linknya = anime.find("h2").find("a").get("href")
print(nomor, judul)
list_url.append(linknya)
nomor += 1
pilihan = input("Masukkan nomor anime: ")
link_anime = list_url[int(pilihan)-1]
os.system("cls" if os.name == "nt" else "clear")
req = r.get(link_anime)
parsing = bs(req.text,"html.parser")
judul = parsing.find("h1").text
print("~"*45)
print("Judul Anime : ",judul)
print("~"*45)
detail = parsing.find("div",attrs={"class":"infozingle"}).findAll("p")
for detail_info in detail:
print(detail_info.text)
print("~"*45)
sinopsis = parsing.find("div",attrs={"class":"sinopc"}).text
print(sinopsis)
print("~"*45)
episode = parsing.findAll("div",attrs={"class":"episodelist"})
listeps = []
nomor = 1
for link in episode:
episodelist = link.findAll("li")
for eps in episodelist:
judul = eps.find("a").text
link = eps.find("a").get("href")
print(nomor, judul)
listeps.append(link)
nomor += 1
piliheps = input("Pilih Episode :")
linkeps = listeps[int(piliheps)-1]
os.system("cls" if os.name == "nt" else "clear")
req = r.get(linkeps)
parsing = bs(req.text,"html.parser")
judul = parsing.find("div",attrs={"class":"batchlink"}).find("h4").text
link = parsing.find("div",attrs={"class":"batchlink"}).findAll("li")
for dunlud in link:
linkdl = dunlud.find("strong").text
a = dunlud.find("a").get("href")
print(linkdl)
print("- ",a)
os.system("cls" if os.name == "nt" else "clear")
katakunci = input("Masukkan nama anime :")
var = search(katakunci)