-
Notifications
You must be signed in to change notification settings - Fork 2
/
anitoki.py
92 lines (71 loc) · 2.18 KB
/
anitoki.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from bs4 import BeautifulSoup
import requests
link = []
no = 1
page = 1
def first():
global no
source = requests.get("https://anitoki.com/").text
soup = BeautifulSoup(source, 'html.parser')
for title in soup.find_all('div', class_='content'):
print("(",no,")", title.h2.text, title.find_all('p')[1].getText())
no += 1
link.append(title.h2.a['href'])
for thumb in soup.find_all('div', class_="thumbz"):
print(thumb.img['src'])
menu()
def menu():
print("Next page (n) | Previous page (p)")
pilih = input("Select : ")
if pilih == "n" or pilih == "N":
next_page()
elif pilih == "p" or pilih == "P":
prev_page()
else:
get_data(int(pilih) - 1)
def next_page():
global page
global link
global no
link = []
page += 1
no = 1
c = requests.get("https://anitoki.com/page/" + str(page)).text
d = BeautifulSoup(c, 'html.parser')
for title in d.find_all('div', class_='content'):
print("(", no, ")", title.h2.text, title.find_all('p')[1].getText())
no += 1
link.append(title.h2.a['href'])
menu()
def prev_page():
global page
global link
global no
page -= 1
no = 1
if page == 0:
print("This is First Page")
first()
else:
link = []
a = requests.get("https://anitoki.com/page/"+str(page)).text
b = BeautifulSoup(a, 'html.parser')
for title in b.find_all('div', class_='content'):
print("(", no, ")", title.h2.text, title.find_all('p')[1].getText())
no += 1
link.append(title.h2.a['href'])
menu()
def get_data(pilihan):
a = requests.get(link[pilihan]).text
b = BeautifulSoup(a, 'html.parser')
for download in b.find_all('div', class_= 'smokeddl'):
print(download.find('div', class_="smokettl").text)
for dl_link in download.find_all('div', class_="smokeurl"):
url_link = []
if dl_link.strong is None:
continue
print(dl_link.strong.text)
for url in dl_link.find_all('a'):
url_link.append(url['href'])
print(url_link)
first()