50 best anime

Web Scraping: TOP 50 BEST ANIME


Some Anime deserves a lot of appreciation for its amazing world-building and craziness. And here is the list of all-time top 50 Best Anime Series. Those 50 Anime that the fans enjoyed the most, which is rated highly on IMDb. Check this link, which shows the 50 Best Animes List. And the Anime, that tops the list is One Piece🐐. 

IMDb List Of Top 50 Best Anime Series Of All Time

This list is created by Marko Opatija.

The list of 50 Best Animes Of All Time, will make you sad and happy at both the time. I was happy to One Piece at the top but there were many Animes which are left out of the list. And we have no one to blame. The anime which you like might be disliked by someone out there. Thus it is pointless to feel or argue whether the certain Anime deserves to be on the list or not. So if you have your own Top 50 Best Anime list, then I am pretty sure that list is fantastic, do share in the comment section.

Web Scraping Using Python

Web Scraping is a technique or a tool using which we can retrieve website information. BeautifulSoup is one such Python module that can help you with Web Scraping.

For starters, install the required module

pip install bs4

Web Scrap Top 50 Animes

If you are new to Python, then check out this Python tutorial series. And also pay a visit to previous articles on Web Scraping for a better idea. But never mind, this article is also beginner-friendly.

Since we have the URL ready, it becomes easier for BeautifulSoup and requests module to extract the website’s information. Simple steps to be followed to Web Scrap the given URL content:

First, import the required modules that are bs4 and requests. Then using requests.get method get the content of the website. Further, parse the content through BeautifulSoup.

Next, open the URL in your browser and inspect the website. For the best practice, click on the content you need to extract and then select inspect. For instance, Consider you need the heading tag data, so click on the head i.e., for example, One Piece in this website. Now if you select inspect a window will appear with large HTML code. Our job is to locate where the head i.e., Anime Name is present.

import requests
from bs4 import BeautifulSoup

def main():
    URL = "https://www.imdb.com/list/ls073161527/"
    site = requests.get(URL).content
    soup = BeautifulSoup(site,"html.parser")

    tag = soup.find("div",class_="lister-list")
    head = tag.find_all("h3")

    with open("top50anime.txt","w") as file:
        for anime in head:
            file.write("\n\n {}".format(anime.text.strip()))

if __name__ == '__main__':

If try searching by entering div tag. Using the parent div tag (lister-list), you can now extract all the h3 content within the website. Moreover, you can also retrieve the paragraph content using the p tag. This tag contains a small bio on the Anime Name.

How To Create A New File In Python?

Store The List Of 50 Best Anime In A File

with open("top50anime.txt","w") as file:
    for anime in head:
        file.write("\n\n {}".format(anime.text.strip()))

On collecting all the details you need a new file to store them. Using with keyword in Python, create a new file in write mode. Note: If you don’t know how to create a new file or If you are not familiar with File Handling in Python. Then check out this article. The information you collected will have extra space accommodated with the text. So using the strip method, remove unwanted spaces. If you are not familiar with the strip method, check Strings In Python. Use “\n\n”, for spacing between two Anime Titles. \n is an escape sequence used to execute the statement in the next line.

If you open or read the file, this is the output you get. You can modify this code and create a CSV file instead of adding anime names and descriptions with the extra column. If you are unable to do it, you can check this article to convert Web Scraping Data into a CSV file.

One Piece: Wan pîsu
(1999– )

(2012– )

Shingeki no Kyojin

Death Note: Desu nôto




Tengen toppa gurren lagann

One Punch Man: Wanpanman

Congratulations you have successfully reached the end of the code and this article.

Subscribe to our Newsletter for more exciting stuff.

If you like our content, support us by Buying a Coffee.