Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2c92f7e

Browse files
Anime Tracker added
1 parent ce7e971 commit 2c92f7e

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

‎Anime_Tracker/anime_tracker.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
3+
try:
4+
import requests
5+
from bs4 import BeautifulSoup
6+
import urllib.parse as parse
7+
import re
8+
import argparse
9+
10+
except ImportError:
11+
print('Some modules are not installed! ')
12+
13+
14+
def details(soup):
15+
16+
info = soup.find('div', {'class': 'pure-1 md-3-5'})
17+
print("\nAbout the Anime : \n", "\t\t", info.find('p').getText(), "\n")
18+
19+
total_episodes = soup.find('div', {'class': 'pure-1 md-1-5'})
20+
print("\nTotal number of episodes :\t",
21+
re.sub("[^0-9]", "", total_episodes.find('span').getText()))
22+
23+
Active_years = soup.find('span', {'class': 'iconYear'})
24+
print("\n Years Active (From-To)\t:\t",
25+
Active_years.getText(), "-\n")
26+
27+
rating = soup.find('div', {'class': 'avgRating'})
28+
print("Rating : ", rating.find('span').getText())
29+
30+
tags = soup.find('div', {'class': 'tags'})
31+
# print("Tags : ", tags.find('ul').getText())
32+
33+
list = []
34+
for _ in range(4):
35+
list.append(tags.find('ul').getText())
36+
37+
print("\nTags : \n")
38+
print((list[0].replace("\n", " ")))
39+
40+
41+
def entry():
42+
print("\nType complete name>>\n")
43+
anime_name = input(
44+
"[+] Enter the name of the Anime : ").strip().title().replace(" ", "-")
45+
46+
print("\n")
47+
print(anime_name)
48+
49+
search_url = ("https://www.anime-planet.com/anime/" + anime_name)
50+
source_code = requests.get(search_url)
51+
content = source_code.content
52+
global soup
53+
soup = BeautifulSoup(content, features="html.parser")
54+
# print(soup.prettify)
55+
56+
try:
57+
details(soup)
58+
except AttributeError:
59+
print("Anime info not found")
60+
61+
62+
if __name__ == "__main__":
63+
entry()

‎Anime_Tracker/anime_tracker_.png

51 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /