Get all HTML tags with BeautifulSoup Last Updated : 25 Feb, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Web scraping is a process of using bots like software called web scrapers in extracting information from HTML or XML content. Beautiful Soup is one such library used for scraping data through python. Beautiful Soup parses through the HTML content of the web page and collects it to provide iteration, searching and modification features on it. To provide these functionalities it works with a parser that converts the content to a parse tree. Using a parser you are comfortable with It's fairly easy to crawl through the web pages using BeautifulSoup. To get all the HTML tags of a web page using the BeautifulSoup library first import BeautifulSoup and requests library to make a GET request to the web page. Step-by-step Approach: Import required modules. Python3 from bs4 import BeautifulSoup import requests After importing the library now assign a URL variable with the URL of the web page and make a GET request to fetch the raw HTML content: Python3 # Assign URL url = "https://www.geeksforgeeks.org/" # Make a GET request to fetch the raw HTML content html_content = requests.get(url).text Now parse the HTML content: Python3 # Parse the html content using any parser soup = BeautifulSoup(html_content,"html.parser") Now to get all the HTML tags of the web page run a loop for the .name attribute of the tag using the find_all() function: Python3 [tag.name for tag in soup.find_all()] Below is the complete program: Python3 # Import modules from bs4 import BeautifulSoup import requests # Assign URL url = "https://www.geeksforgeeks.org/" # Make a GET request to fetch the raw HTML content html_content = requests.get(url).text # Parse the html content using any parser soup = BeautifulSoup(html_content, "html.parser") # Display HTML tags [tag.name for tag in soup.find_all()] Output: ['html', 'head', 'meta', 'meta', 'meta', 'link', 'meta', 'meta', 'meta', 'meta', 'meta', 'script', 'script', 'link', 'title', 'link', 'link', 'script', 'script'] Comment More infoAdvertise with us Next Article Python BeautifulSoup - find all class A aniketparihar1718 Follow Improve Article Tags : Python Python BeautifulSoup Practice Tags : python Similar Reads Converting HTML to Text with BeautifulSoup Many times while working with web automation we need to convert HTML code into Text. This can be done using the BeautifulSoup. This module provides get_text() function that takes HTML as input and returns text as output. Example 1: Python3 # importing the library from bs4 import BeautifulSoup # Init 1 min read Python BeautifulSoup - find all class Prerequisite:- Requests , BeautifulSoup The task is to write a program to find all the classes for a given Website URL. In Beautiful Soup there is no in-built method to find all classes. Module needed: bs4: Beautiful Soup(bs4) is a Python library for pulling data out of HTML and XML files. This modu 2 min read Parsing tables and XML with BeautifulSoup Scraping is a very essential skill that everybody should learn, It helps us to scrap data from a website or a file that can be used in another beautiful manner by the programmer. In this article, we will learn how to extract tables with beautiful soup and XML from a file. Here, we will scrap data us 4 min read Scraping Reddit with Python and BeautifulSoup In this article, we are going to see how to scrape Reddit with Python and BeautifulSoup. Here we will use Beautiful Soup and the request module to scrape the data. Module neededbs4: Beautiful Soup(bs4) is a Python library for pulling data out of HTML and XML files. This module does not come built-in 3 min read BeautifulSoup - Remove the contents of tag In this article, we are going to see how to remove the content tag from HTML using BeautifulSoup. BeautifulSoup is a python library used for extracting html and xml files. Modules needed: BeautifulSoup: Our primary module contains a method to access a webpage over HTTP. For installation run this com 2 min read BeautifulSoup - Find all <li> in <ul> Prerequisites: Beautifulsoup Beautifulsoup is a Python module used for web scraping. In this article, we will discuss how contents of <li> tags can be retrieved from <ul> using Beautifulsoup. Modules Needed:bs4: Beautiful Soup(bs4)  is a Python library for pulling data out of HTML and X 3 min read Like