• October 3, 2023

Parse Html Beautifulsoup

Guide to Parsing HTML with BeautifulSoup in Python – Stack …

Web scraping is programmatically collecting information from various websites. While there are many libraries and frameworks in various languages that can extract web data, Python has long been a popular choice because of its plethora of options for web scraping.
This article will give you a crash course on web scraping in Python with Beautiful Soup – a popular Python library for parsing HTML and XML.
Ethical Web Scraping
Web scraping is ubiquitous and gives us data as we would get with an API. However, as good citizens of the internet, it’s our responsibility to respect the site owners we scrape from. Here are some principles that a web scraper should adhere to:
Don’t claim scraped content as our own. Website owners sometimes spend a lengthy amount of time creating articles, collecting details about products or harvesting other content. We must respect their labor and originality.
Don’t scrape a website that doesn’t want to be scraped. Websites sometimes come with a file – which defines the parts of a website that can be scraped. Many websites also have a Terms of Use which may not allow scraping. We must respect websites that do not want to be scraped.
Is there an API available already? Splendid, there’s no need for us to write a scraper. APIs are created to provide access to data in a controlled way as defined by the owners of the data. We prefer to use APIs if they’re available.
Making requests to a website can cause a toll on a website’s performance. A web scraper that makes too many requests can be as debilitating as a DDOS attack. We must scrape responsibly so we won’t cause any disruption to the regular functioning of the website.
An Overview of Beautiful Soup
The HTML content of the webpages can be parsed and scraped with Beautiful Soup. In the following section, we will be covering those functions that are useful for scraping webpages.
What makes Beautiful Soup so useful is the myriad functions it provides to extract data from HTML. This image below illustrates some of the functions we can use:
Let’s get hands-on and see how we can parse HTML with Beautiful Soup. Consider the following HTML page saved to file as

Head’s title

Body’s title

line begins

line ends

The following code snippets are tested on Ubuntu 20. 04. 1 LTS. You can install the BeautifulSoup module by typing the following command in the terminal:
$ pip3 install beautifulsoup4
The HTML file needs to be prepared. This is done by passing the file to the BeautifulSoup constructor, let’s use the interactive Python shell for this, so we can instantly print the contents of a specific part of a page:
from bs4 import BeautifulSoup
with open(“”) as fp:
soup = BeautifulSoup(fp, “”)
Now we can use Beautiful Soup to navigate our website and extract data.
Navigating to Specific Tags
From the soup object created in the previous section, let’s get the title tag of
# returns Head’s title
Here’s a breakdown of each component we used to get the title:
Beautiful Soup is powerful because our Python objects match the nested structure of the HTML document we are scraping.
To get the text of the first tag, enter this:
# returns ‘1’
To get the title within the HTML’s body tag (denoted by the “title” class), type the following in your terminal:
# returns Body’s title
For deeply nested HTML documents, navigation could quickly become tedious. Luckily, Beautiful Soup comes with a search function so we don’t have to navigate to retrieve HTML elements.
Searching the Elements of Tags
The find_all() method takes an HTML tag as a string argument and returns the list of elements that match with the provided tag. For example, if we want all a tags in
We’ll see this list of a tags as output:
1, 2, 3]
Here’s a breakdown of each component we used to search for a tag:
We can search for tags of a specific class as well by providing the class_ argument. Beautiful Soup uses class_ because class is a reserved keyword in Python. Let’s search for all a tags that have the “element” class:
nd_all(“a”, class_=”element”)
As we only have two links with the “element” class, you’ll see this output:
[1, 2]
What if we wanted to fetch the links embedded inside the a tags? Let’s retrieve a link’s href attribute using the find() option. It works just like find_all() but it returns the first matching element instead of a list. Type this in your shell:
(“a”, href=True)[“href”] # returns
The find() and find_all() functions also accept a regular expression instead of a string. Behind the scenes, the text will be filtered using the compiled regular expression’s search() method. For example:
import re
for tag in nd_all(mpile(“^b”)):
The list upon iteration, fetches the tags starting with the character b which includes and :

Body’s title
Check out our hands-on, practical guide to learning Git, with best-practices, industry-accepted standards, and included cheat sheet. Stop Googling Git commands and actually learn it! We’ve covered the most popular ways to get tags and their attributes. Sometimes, especially for less dynamic web pages, we just want the text from it. Let’s see how we can get it!
Getting the Whole Text
The get_text() function retrieves all the text from the HTML document. Let’s get all the text of the HTML document:
Your output should be like this:
Head’s title
Body’s title
line begins
line ends
Sometimes the newline characters are printed, so your output may look like this as well:
“\n\nHead’s title\n\n\nBody’s title\nline begins\n 1\n2\n3\n line ends\n\n”
Now that we have a feel for how to use Beautiful Soup, let’s scrape a website!
Beautiful Soup in Action – Scraping a Book List
Now that we have mastered the components of Beautiful Soup, it’s time to put our learning to use. Let’s build a scraper to extract data from and save it to a CSV file. The site contains random data about books and is a great space to test out your web scraping techniques.
First, create a new file called Let’s import all the libraries we need for this script:
import requests
import time
import csv
In the modules mentioned above:
requests – performs the URL request and fetches the website’s HTML
time – limits how many times we scrape the page at once
csv – helps us export our scraped data to a CSV file
re – allows us to write regular expressions that will come in handy for picking text based on its pattern
bs4 – yours truly, the scraping module to parse the HTML
You would have bs4 already installed, and time, csv, and re are built-in packages in Python. You’ll need to install the requests module directly like this:
$ pip3 install requests
Before you begin, you need to understand how the webpage’s HTML is structured. In your browser, let’s go to. Then right-click on the components of the webpage to be scraped, and click on the inspect button to understand the hierarchy of the tags as shown below.
This will show you the underlying HTML for what you’re inspecting. The following picture illustrates these steps:
From inspecting the HTML, we learn how to access the URL of the book, the cover image, the title, the rating, the price, and more fields from the HTML. Let’s write a function that scrapes a book item and extract its data:
def scrape(source_url, soup): # Takes the driver and the subdomain for concats as params
# Find the elements of the article tag
books = nd_all(“article”, class_=”product_pod”)
# Iterate over each book article tag
for each_book in books:
info_url = source_url+”/”(“a”)[“href”]
cover_url = source_url+”/catalogue” + \
[“src”]. replace(“.. “, “”)
title = (“a”)[“title”]
rating = (“p”, class_=”star-rating”)[“class”][1]
# can also be written as: (“a”)(“title”)
price = (“p”, class_=”price_color”)()(
“ascii”, “ignore”)(“ascii”)
availability = (
“p”, class_=”instock availability”)()
# Invoke the write_to_csv function
write_to_csv([info_url, cover_url, title, rating, price, availability])
The last line of the above snippet points to a function to write the list of scraped strings to a CSV file. Let’s add that function now:
def write_to_csv(list_input):
# The scraped info will be written to a CSV here.
with open(“”, “a”) as fopen: # Open the csv file.
csv_writer = (fopen)
csv_writer. writerow(list_input)
return False
As we have a function that can scrape a page and export to CSV, we want another function that crawls through the paginated website, collecting book data on each page.
To do this, let’s look at the URL we are writing this scraper for:

The only varying element in the URL is the page number. We can format the URL dynamically so it becomes a seed URL:
This string formatted URL with the page number can be fetched using the method (). We can then create a new BeautifulSoup object. Every time we get the soup object, the presence of the “next” button is checked so we could stop at the last page. We keep track of a counter for the page number that’s incremented by 1 after successfully scraping a page.
def browse_and_scrape(seed_url, page_number=1):
# Fetch the URL – We will be using this to append to images and info routes
url_pat = mpile(r”(. *\)”)
source_url = (seed_url)(0)
# Page_number from the argument gets formatted in the URL & Fetched
formatted_url = (str(page_number))
html_text = (formatted_url)
# Prepare the soup
soup = BeautifulSoup(html_text, “”)
print(f”Now Scraping – {formatted_url}”)
# This if clause stops the script when it hits an empty page
if (“li”, class_=”next”)! = None:
scrape(source_url, soup) # Invoke the scrape function
# Be a responsible citizen by waiting before you hit again
page_number += 1
# Recursively invoke the same function with the increment
browse_and_scrape(seed_url, page_number)
scrape(source_url, soup) # The script exits here
return True
except Exception as e:
return e
The function above, browse_and_scrape(), is recursively called until the function (“li”, class_=”next”) returns None. At this point, the code will scrape the remaining part of the webpage and exit.
For the final piece to the puzzle, we initiate the scraping flow. We define the seed_url and call the browse_and_scrape() to get the data. This is done under the if __name__ == “__main__” block:
if __name__ == “__main__”:
seed_url = “}”
print(“Web scraping has begun”)
result = browse_and_scrape(seed_url)
if result == True:
print(“Web scraping is now complete! “)
print(f”Oops, That doesn’t seem right!!! – {result}”)
If you’d like to learn more about the if __name__ == “__main__” block, check out our guide on how it works.
You can execute the script as shown below in your terminal and get the output as:
$ python
Web scraping has begun
Now Scraping – Now Scraping – Now Scraping -…
Now Scraping – Now Scraping – Web scraping is now complete!
The scraped data can be found in the current working directory under the filename Here’s a sample the file’s content:
Light in the Attic, Three, 51. 77, In stock
the Velvet, One, 53. 74, In stock
Good job! If you wanted to have a look at the scraper code as a whole, you can find it on GitHub.
In this tutorial, we learned the ethics of writing good web scrapers. We then used Beautiful Soup to extract data from an HTML file using the Beautiful Soup’s object properties, and it’s various methods like find(), find_all() and get_text(). We then built a scraper than retrieves a book list online and exports to CSV.
Web scraping is a useful skill that helps in various activities such as extracting data like an API, performing QA on a website, checking for broken URLs on a website, and more. What’s the next scraper you’re going to build?
Beautiful Soup 4.9.0 documentation - Crummy

Beautiful Soup 4.9.0 documentation – Crummy

Beautiful Soup is a
Python library for pulling data out of HTML and XML files. It works
with your favorite parser to provide idiomatic ways of navigating,
searching, and modifying the parse tree. It commonly saves programmers
hours or days of work.
These instructions illustrate all major features of Beautiful Soup 4,
with examples. I show you what the library is good for, how it works,
how to use it, how to make it do what you want, and what to do when it
violates your expectations.
This document covers Beautiful Soup version 4. 9. 3. The examples in
this documentation should work the same way in Python 2. 7 and Python
3. 8.
You might be looking for the documentation for Beautiful Soup 3.
If so, you should know that Beautiful Soup 3 is no longer being
developed and that support for it will be dropped on or after December
31, 2020. If you want to learn about the differences between Beautiful
Soup 3 and Beautiful Soup 4, see Porting code to BS4.
This documentation has been translated into other languages by
Beautiful Soup users:
이 문서는 한국어 번역도 가능합니다.
Este documento também está disponível em Português do Brasil.
Эта документация доступна на русском языке.
Getting help¶
If you have questions about Beautiful Soup, or run into problems,
send mail to the discussion group. If
your problem involves parsing an HTML document, be sure to mention
what the diagnose() function says about
that document.
Here’s an HTML document I’ll be using as an example throughout this
document. It’s part of a story from Alice in Wonderland:
html_doc = “””The Dormouse’s story

The Dormouse’s story

Once upon a time there were three little sisters; and their names were
Lacie and
and they lived at the bottom of a well.

Running the “three sisters” document through Beautiful Soup gives us a
BeautifulSoup object, which represents the document as a nested
data structure:
from bs4 import BeautifulSoup
soup = BeautifulSoup(html_doc, ”)
# <br /> # The Dormouse’s story<br /> #




# Once upon a time there were three little sisters; and their names were
# Elsie

# Lacie
# and

# Tillie
#; and they lived at the bottom of a well.
Here are some simple ways to navigate that data structure:
# The Dormouse’s story
# u’title’
# u’The Dormouse’s story’
# u’head’
soup. p

The Dormouse’s story

soup. p[‘class’]
soup. a
# [Elsie,
# Lacie,
# Tillie]
# Tillie
One common task is extracting all the URLs found within a page’s tags:
for link in nd_all(‘a’):
# # #
Another common task is extracting all the text from a page:
# Elsie,
# Lacie and
# Tillie;
# and they lived at the bottom of a well.
Does this look like what you need? If so, read on.
If you’re using a recent version of Debian or Ubuntu Linux, you can
install Beautiful Soup with the system package manager:
$ apt-get install python-bs4 (for Python 2)
$ apt-get install python3-bs4 (for Python 3)
Beautiful Soup 4 is published through PyPi, so if you can’t install it
with the system packager, you can install it with easy_install or
pip. The package name is beautifulsoup4, and the same package
works on Python 2 and Python 3. Make sure you use the right version of
pip or easy_install for your Python version (these may be named
pip3 and easy_install3 respectively if you’re using Python 3).
$ easy_install beautifulsoup4
$ pip install beautifulsoup4
(The BeautifulSoup package is not what you want. That’s
the previous major release, Beautiful Soup 3. Lots of software uses
BS3, so it’s still available, but if you’re writing new code you
should install beautifulsoup4. )
If you don’t have easy_install or pip installed, you can
download the Beautiful Soup 4 source tarball and
install it with
$ python install
If all else fails, the license for Beautiful Soup allows you to
package the entire library with your application. You can download the
tarball, copy its bs4 directory into your application’s codebase,
and use Beautiful Soup without installing it at all.
I use Python 2. 7 and Python 3. 8 to develop Beautiful Soup, but it
should work with other recent versions.
Problems after installation¶
Beautiful Soup is packaged as Python 2 code. When you install it for
use with Python 3, it’s automatically converted to Python 3 code. If
you don’t install the package, the code won’t be converted. There have
also been reports on Windows machines of the wrong version being
If you get the ImportError “No module named HTMLParser”, your
problem is that you’re running the Python 2 version of the code under
Python 3.
If you get the ImportError “No module named ”, your
problem is that you’re running the Python 3 version of the code under
Python 2.
In both cases, your best bet is to completely remove the Beautiful
Soup installation from your system (including any directory created
when you unzipped the tarball) and try the installation again.
If you get the SyntaxError “Invalid syntax” on the line
ROOT_TAG_NAME = u'[document]’, you need to convert the Python 2
code to Python 3. You can do this either by installing the package:
$ python3 install
or by manually running Python’s 2to3 conversion script on the
bs4 directory:
$ 2to3-3. 2 -w bs4
Installing a parser¶
Beautiful Soup supports the HTML parser included in Python’s standard
library, but it also supports a number of third-party Python parsers.
One is the lxml parser. Depending on your setup,
you might install lxml with one of these commands:
$ apt-get install python-lxml
$ easy_install lxml
$ pip install lxml
Another alternative is the pure-Python html5lib parser, which parses HTML the way a
web browser does. Depending on your setup, you might install html5lib
with one of these commands:
$ apt-get install python-html5lib
$ easy_install html5lib
$ pip install html5lib
This table summarizes the advantages and disadvantages of each parser library:
Typical usage
BeautifulSoup(markup, “”)
Batteries included
Decent speed
Lenient (As of Python 2. 7. 3
and 3. 2. )
Not as fast as lxml,
less lenient than
lxml’s HTML parser
BeautifulSoup(markup, “lxml”)
Very fast
External C dependency
lxml’s XML parser
BeautifulSoup(markup, “lxml-xml”)
BeautifulSoup(markup, “xml”)
The only currently supported
XML parser
BeautifulSoup(markup, “html5lib”)
Extremely lenient
Parses pages the same way a
web browser does
Creates valid HTML5
Very slow
External Python
If you can, I recommend you install and use lxml for speed. If you’re
using a very old version of Python – earlier than 2. 3 or 3. 2 –
it’s essential that you install lxml or html5lib. Python’s built-in
HTML parser is just not very good in those old versions.
Note that if a document is invalid, different parsers will generate
different Beautiful Soup trees for it. See Differences
between parsers for details.
To parse a document, pass it into the BeautifulSoup
constructor. You can pass in a string or an open filehandle:
with open(“”) as fp:
soup = BeautifulSoup(fp, ”)
soup = BeautifulSoup(“a web page“, ”)
First, the document is converted to Unicode, and HTML entities are
converted to Unicode characters:
print(BeautifulSoup(“Sacré bleu! “, “”))
# Sacré bleu!
Beautiful Soup then parses the document using the best available
parser. It will use an HTML parser unless you specifically tell it to
use an XML parser. (See Parsing XML. )
Beautiful Soup transforms a complex HTML document into a complex tree
of Python objects. But you’ll only ever have to deal with about four
kinds of objects: Tag, NavigableString, BeautifulSoup,
and Comment.
A Tag object corresponds to an XML or HTML tag in the original document:
soup = BeautifulSoup(‘Extremely bold‘, ”)
tag = soup. b
Tags have a lot of attributes and methods, and I’ll cover most of them
in Navigating the tree and Searching the tree. For now, the most
important features of a tag are its name and attributes.
Every tag has a name, accessible as
If you change a tag’s name, the change will be reflected in any HTML
markup generated by Beautiful Soup:
= “blockquote”

Extremely bold

A tag may have any number of attributes. The tag has an attribute “id” whose value is
“boldest”. You can access a tag’s attributes by treating the tag like
a dictionary:
tag = BeautifulSoup(‘bold‘, ”). b
# ‘boldest’
You can access that dictionary directly as
# {‘id’: ‘boldest’}
You can add, remove, and modify a tag’s attributes. Again, this is
done by treating the tag as a dictionary:
tag[‘id’] = ‘verybold’
tag[‘another-attribute’] = 1
del tag[‘id’]
del tag[‘another-attribute’]
# bold
# KeyError: ‘id’
# None
Multi-valued attributes¶
HTML 4 defines a few attributes that can have multiple values. HTML 5
removes a couple of them, but defines a few more. The most common
multi-valued attribute is class (that is, a tag can have more than
one CSS class). Others include rel, rev, accept-charset,
headers, and accesskey. Beautiful Soup presents the value(s)
of a multi-valued attribute as a list:
css_soup = BeautifulSoup(‘

‘, ”)
css_soup. p[‘class’]
# [‘body’]
css_soup = BeautifulSoup(‘

‘, ”)
# [‘body’, ‘strikeout’]
If an attribute looks like it has more than one value, but it’s not
a multi-valued attribute as defined by any version of the HTML
standard, Beautiful Soup will leave the attribute alone:
id_soup = BeautifulSoup(‘

‘, ”)
id_soup. p[‘id’]
# ‘my id’
When you turn a tag back into a string, multiple attribute values are
rel_soup = BeautifulSoup(‘

Back to the homepage

‘, ”)
rel_soup. a[‘rel’]
# [‘index’]
rel_soup. a[‘rel’] = [‘index’, ‘contents’]
print(rel_soup. p)

Back to the homepage

You can disable this by passing multi_valued_attributes=None as a
keyword argument into the BeautifulSoup constructor:
no_list_soup = BeautifulSoup(‘

‘, ”, multi_valued_attributes=None)
no_list_soup. p[‘class’]
# ‘body strikeout’
You can use get_attribute_list to get a value that’s always a
list, whether or not it’s a multi-valued atribute:
# [“my id”]
If you parse a document as XML, there are no multi-valued attributes:
xml_soup = BeautifulSoup(‘

‘, ‘xml’)
xml_soup. p[‘class’]
Again, you can configure this using the multi_valued_attributes argument:
class_is_multi= { ‘*’: ‘class’}
xml_soup = BeautifulSoup(‘

‘, ‘xml’, multi_valued_attributes=class_is_multi)
You probably won’t need to do this, but if you do, use the defaults as
a guide. They implement the rules described in the HTML specification:
from er import builder_registry
A string corresponds to a bit of text within a tag. Beautiful Soup
uses the NavigableString class to contain these bits of text:
# ‘Extremely bold’
A NavigableString is just like a Python Unicode string, except
that it also supports some of the features described in Navigating
the tree and Searching the tree. You can convert a
NavigableString to a Unicode string with unicode() (in
Python 2) or str (in Python 3):
unicode_string = str()
You can’t edit a string in place, but you can replace one string with
another, using replace_with():
(“No longer bold”)
# No longer bold
NavigableString supports most of the features described in
Navigating the tree and Searching the tree, but not all of
them. In particular, since a string can’t contain anything (the way a
tag may contain a string or another tag), strings don’t support the. contents or attributes, or the find() method.
If you want to use a NavigableString outside of Beautiful Soup,
you should call unicode() on it to turn it into a normal Python
Unicode string. If you don’t, your string will carry around a
reference to the entire Beautiful Soup parse tree, even when you’re
done using Beautiful Soup. This is a big waste of memory.
The BeautifulSoup object represents the parsed document as a
whole. For most purposes, you can treat it as a Tag
object. This means it supports most of the methods described in
Navigating the tree and Searching the tree.
You can also pass a BeautifulSoup object into one of the methods
defined in Modifying the tree, just as you would a Tag. This
lets you do things like combine two parsed documents:
doc = BeautifulSoup(“INSERT FOOTER HEREHere’s the footer

“, “xml”)
(text=”INSERT FOOTER HERE”). replace_with(footer)

Here’s the footer

Since the BeautifulSoup object doesn’t correspond to an actual
HTML or XML tag, it has no name and no attributes. But sometimes it’s
useful to look at its, so it’s been given the special
Here’s the “Three sisters” HTML document again:
html_doc = “””
The Dormouse’s story
I’ll use this as an example to show you how to move from one part of
a document to another.
Going down¶
Tags may contain strings and other tags. These elements are the tag’s
children. Beautiful Soup provides a lot of different attributes for
navigating and iterating over a tag’s children.
Note that Beautiful Soup strings don’t support any of these
attributes, because a string can’t have children.
Navigating using tag names¶
The simplest way to navigate the parse tree is to say the name of the
tag you want. If you want the tag, just say
# The Dormouse’s story
You can do use this trick again and again to zoom in on a certain part
of the parse tree. This code gets the first tag beneath the tag:
# The Dormouse’s story
Using a tag name as an attribute will give you only the first tag by that
If you need to get all the tags, or anything more complicated
than the first tag with a certain name, you’ll need to use one of the
methods described in Searching the tree, such as find_all():
Tillie]. contents and. children¶
A tag’s children are available in a list called. contents:
head_tag =
# [The Dormouse’s story]
title_tag = ntents[0]
# [‘The Dormouse’s story’]
The BeautifulSoup object itself has children. In this case, the
tag is the child of the BeautifulSoup object. :
# 1
# ‘html’
A string does not have. contents, because it can’t contain
text = ntents[0]
# AttributeError: ‘NavigableString’ object has no attribute ‘contents’
Instead of getting them as a list, you can iterate over a tag’s
children using the. children generator:
for child in ildren:
# The Dormouse’s story. descendants¶
The. children attributes only consider a tag’s
direct children. For instance, the tag has a single direct
child–the tag:<br /> But the <title> tag itself has a child: the string “The Dormouse’s<br /> story”. There’s a sense in which that string is also a child of the<br /> <head> tag. The. descendants attribute lets you iterate over all<br /> of a tag’s children, recursively: its direct children, the children of<br /> its direct children, and so on:<br /> for child in scendants:<br /> The <head> tag has only one child, but it has two descendants: the<br /> <title> tag and the <title> tag’s child. The BeautifulSoup object<br /> only has one direct child (the <html> tag), but it has a whole lot of<br /> descendants:<br /> len(list(ildren))<br /> len(list(scendants))<br /> # 26<br /> ¶<br /> If a tag has only one child, and that child is a NavigableString,<br /> the child is made available as<br /> # ‘The Dormouse’s story’<br /> If a tag’s only child is another tag, and that tag has a, then the parent tag is considered to have the same<br /> as its child:<br /> If a tag contains more than one thing, then it’s not clear what<br /> should refer to, so is defined to be<br /> None:<br /> print()<br /> # None. strings and stripped_strings¶<br /> If there’s more than one thing inside a tag, you can still look at<br /> just the strings. Use the. strings generator:<br /> for string in rings:<br /> print(repr(string))<br /> ‘\n’<br /> # “The Dormouse’s story”<br /> # ‘\n’<br /> # ‘Once upon a time there were three little sisters; and their names were\n’<br /> # ‘Elsie’<br /> # ‘, \n’<br /> # ‘Lacie’<br /> # ‘ and\n’<br /> # ‘Tillie’<br /> # ‘;\nand they lived at the bottom of a well. ‘<br /> # ‘… ‘<br /> These strings tend to have a lot of extra whitespace, which you can<br /> remove by using the. stripped_strings generator instead:<br /> for string in ripped_strings:<br /> # ‘Once upon a time there were three little sisters; and their names were’<br /> # ‘, ‘<br /> # ‘and’<br /> # ‘;\n and they lived at the bottom of a well. ‘<br /> Here, strings consisting entirely of whitespace are ignored, and<br /> whitespace at the beginning and end of strings is removed.<br /> Going up¶<br /> Continuing the “family tree” analogy, every tag and every string has a<br /> parent: the tag that contains it.<br /> You can access an element’s parent with the attribute. In<br /> the example “three sisters” document, the <head> tag is the parent<br /> of the <title> tag:<br /> title_tag =<br /> The title string itself has a parent: the <title> tag that contains<br /> it:<br /> The parent of a top-level tag like <html> is the BeautifulSoup object<br /> itself:<br /> html_tag =<br /> # <class 'autifulSoup'><br /> And the of a BeautifulSoup object is defined as None:<br /> # None. parents¶<br /> You can iterate over all of an element’s parents with. parents. This example uses. parents to travel from an <a> tag<br /> buried deep within the document, to the very top of the document:<br /> link = soup. a<br /> link<br /> for parent in rents:<br /> # p<br /> # body<br /> # html<br /> # [document]<br /> Going sideways¶<br /> Consider a simple document like this:<br /> sibling_soup = BeautifulSoup(“<a><b>text1</b><c>text2</c></b></a>“, ”)<br /> # <a><br /> # text1<br /> # <c><br /> # text2<br /> # </c><br /> The <b> tag and the <c> tag are at the same level: they’re both direct<br /> children of the same tag. We call them siblings. When a document is<br /> pretty-printed, siblings show up at the same indentation level. You<br /> can also use this relationship in the code you write.. next_sibling and. previous_sibling¶<br /> You can use. previous_sibling to navigate<br /> between page elements that are on the same level of the parse tree:<br /> xt_sibling<br /> # <c>text2</c><br /> evious_sibling<br /> # <b>text1</b><br /> The <b> tag has a. next_sibling, but no. previous_sibling,<br /> because there’s nothing before the <b> tag on the same level of the<br /> tree. For the same reason, the <c> tag has a. previous_sibling<br /> but no. next_sibling:<br /> print(evious_sibling)<br /> print(xt_sibling)<br /> The strings “text1” and “text2” are not siblings, because they don’t<br /> have the same parent:<br /> # ‘text1’<br /> In real documents, the. next_sibling or. previous_sibling of a<br /> tag will usually be a string containing whitespace. Going back to the<br /> “three sisters” document:<br /> # <a href=" class="sister" id="link1">Elsie</a><br /> # <a href=" class="sister" id="link2">Lacie</a><br /> # <a href=" class="sister" id="link3">Tillie</a><br /> You might think that the. next_sibling of the first <a> tag would<br /> be the second <a> tag. But actually, it’s a string: the comma and<br /> newline that separate the first <a> tag from the second:<br /> # ‘, \n ‘<br /> The second <a> tag is actually the. next_sibling of the comma:<br /> # <a class="sister" href=" id="link2">Lacie</a>. next_siblings and. previous_siblings¶<br /> You can iterate over a tag’s siblings with. next_siblings or. previous_siblings:<br /> for sibling in xt_siblings:<br /> print(repr(sibling))<br /> # <a class="sister" href=" id="link2">Lacie</a><br /> # ‘; and they lived at the bottom of a well. ‘<br /> for sibling in (id=”link3″). previous_siblings:<br /> Going back and forth¶<br /> Take a look at the beginning of the “three sisters” document:<br /> # <html><head><title>The Dormouse’s story
An HTML parser takes this string of characters and turns it into a
series of events: “open an tag”, “open a tag”, “open a
tag”, “add a string”, “close the <title> tag”, “open a </p> <p> tag”, and so on. Beautiful Soup offers tools for reconstructing the<br /> initial parse of the document.. next_element and. previous_element¶<br /> The. next_element attribute of a string or tag points to whatever<br /> was parsed immediately afterwards. It might be the same as. next_sibling, but it’s usually drastically different.<br /> Here’s the final <a> tag in the “three sisters” document. Its. next_sibling is a string: the conclusion of the sentence that was<br /> interrupted by the start of the <a> tag. :<br /> last_a_tag = (“a”, id=”link3″)<br /> last_a_tag<br /> But the. next_element of that <a> tag, the thing that was parsed<br /> immediately after the <a> tag, is not the rest of that sentence:<br /> it’s the word “Tillie”:<br /> xt_element<br /> That’s because in the original markup, the word “Tillie” appeared<br /> before that semicolon. The parser encountered an <a> tag, then the<br /> word “Tillie”, then the closing </a> tag, then the semicolon and rest of<br /> the sentence. The semicolon is on the same level as the <a> tag, but the<br /> word “Tillie” was encountered first.<br /> The. previous_element attribute is the exact opposite of. next_element. It points to whatever element was parsed<br /> immediately before this one:<br /> evious_element<br /> # <a class="sister" href=" id="link3">Tillie</a>. next_elements and. previous_elements¶<br /> You should get the idea by now. You can use these iterators to move<br /> forward or backward in the document as it was parsed:<br /> for element in xt_elements:<br /> print(repr(element))<br /> # </p> <p class="story">… </p> <p>Beautiful Soup defines a lot of methods for searching the parse tree,<br /> but they’re all very similar. I’m going to spend a lot of time explaining<br /> the two most popular methods: find() and find_all(). The other<br /> methods take almost exactly the same arguments, so I’ll just cover<br /> them briefly.<br /> Once again, I’ll be using the “three sisters” document as an example:<br /> By passing in a filter to an argument like find_all(), you can<br /> zoom in on the parts of the document you’re interested in.<br /> Kinds of filters¶<br /> Before talking in detail about find_all() and similar methods, I<br /> want to show examples of different filters you can pass into these<br /> methods. These filters show up again and again, throughout the<br /> search API. You can use them to filter based on a tag’s name,<br /> on its attributes, on the text of a string, or on some combination of<br /> these.<br /> A string¶<br /> The simplest filter is a string. Pass a string to a search method and<br /> Beautiful Soup will perform a match against that exact string. This<br /> code finds all the <b> tags in the document:<br /> nd_all(‘b’)<br /> # [<b>The Dormouse’s story</b>]<br /> If you pass in a byte string, Beautiful Soup will assume the string is<br /> encoded as UTF-8. You can avoid this by passing in a Unicode string instead.<br /> A regular expression¶<br /> If you pass in a regular expression object, Beautiful Soup will filter<br /> against that regular expression using its search() method. This code<br /> finds all the tags whose names start with the letter “b”; in this<br /> case, the <body> tag and the <b> tag:<br /> import re<br /> for tag in nd_all(mpile(“^b”)):<br /> # b<br /> This code finds all the tags whose names contain the letter ‘t’:<br /> for tag in nd_all(mpile(“t”)):<br /> # title<br /> A list¶<br /> If you pass in a list, Beautiful Soup will allow a string match<br /> against any item in that list. This code finds all the <a> tags<br /> and all the <b> tags:<br /> nd_all([“a”, “b”])<br /> # [<b>The Dormouse’s story</b>,<br /> # <a class="sister" href=" id="link1">Elsie</a>,<br /> True¶<br /> The value True matches everything it can. This code finds all<br /> the tags in the document, but none of the text strings:<br /> for tag in nd_all(True):<br /> # head<br /> # a<br /> A function¶<br /> If none of the other matches work for you, define a function that<br /> takes an element as its only argument. The function should return<br /> True if the argument matches, and False otherwise.<br /> Here’s a function that returns True if a tag defines the “class”<br /> attribute but doesn’t define the “id” attribute:<br /> def has_class_but_no_id(tag):<br /> return tag. has_attr(‘class’) and not tag. has_attr(‘id’)<br /> Pass this function into find_all() and you’ll pick up all the </p> <p> tags:<br /> nd_all(has_class_but_no_id)<br /> # [</p> <p class="title"><b>The Dormouse’s story</b></p> <p>,<br /> # </p> <p class="story">Once upon a time there were…bottom of a well. </p> <p>,<br /> # </p> <p class="story">… </p> <p>]<br /> This function only picks up the </p> <p> tags. It doesn’t pick up the <a><br /> tags, because those tags define both “class” and “id”. It doesn’t pick<br /> up tags like <html> and <title>, because those tags don’t define<br /> “class”.<br /> If you pass in a function to filter on a specific attribute like<br /> href, the argument passed into the function will be the attribute<br /> value, not the whole tag. Here’s a function that finds all a tags<br /> whose href attribute does not match a regular expression:<br /> def not_lacie(href):<br /> return href and not mpile(“lacie”)(href)<br /> nd_all(href=not_lacie)<br /> The function can be as complicated as you need it to be. Here’s a<br /> function that returns True if a tag is surrounded by string<br /> objects:<br /> from bs4 import NavigableString<br /> def surrounded_by_strings(tag):<br /> return (isinstance(xt_element, NavigableString)<br /> and isinstance(evious_element, NavigableString))<br /> for tag in nd_all(surrounded_by_strings):<br /> Now we’re ready to look at the search methods in detail.<br /> find_all()¶<br /> Method signature: find_all(name, attrs, recursive, string, limit, **kwargs)<br /> The find_all() method looks through a tag’s descendants and<br /> retrieves all descendants that match your filters. I gave several<br /> examples in Kinds of filters, but here are a few more:<br /> nd_all(“title”)<br /> nd_all(“p”, “title”)<br /> # [</p> <p class="title"><b>The Dormouse’s story</b></p> <p>]<br /> nd_all(“a”)<br /> nd_all(id=”link2″)<br /> # [<a class="sister" href=" id="link2">Lacie</a>]<br /> (mpile(“sisters”))<br /> Some of these should look familiar, but others are new. What does it<br /> mean to pass in a value for string, or id? Why does<br /> find_all(“p”, “title”) find a </p> <p> tag with the CSS class “title”?<br /> Let’s look at the arguments to find_all().<br /> The name argument¶<br /> Pass in a value for name and you’ll tell Beautiful Soup to only<br /> consider tags with certain names. Text strings will be ignored, as<br /> will tags whose names that don’t match.<br /> This is the simplest usage:<br /> Recall from Kinds of filters that the value to name can be a<br /> string, a regular expression, a list, a function, or the value<br /> True.<br /> The keyword arguments¶<br /> Any argument that’s not recognized will be turned into a filter on one<br /> of a tag’s attributes. If you pass in a value for an argument called id,<br /> Beautiful Soup will filter against each tag’s ‘id’ attribute:<br /> nd_all(id=’link2′)<br /> If you pass in a value for href, Beautiful Soup will filter<br /> against each tag’s ‘href’ attribute:<br /> nd_all(mpile(“elsie”))<br /> # [<a class="sister" href=" id="link1">Elsie</a>]<br /> You can filter an attribute based on a string, a regular<br /> expression, a list, a function, or the value True.<br /> This code finds all tags whose id attribute has a value,<br /> regardless of what the value is:<br /> nd_all(id=True)<br /> You can filter multiple attributes at once by passing in more than one<br /> keyword argument:<br /> nd_all(mpile(“elsie”), id=’link1′)<br /> Some attributes, like the data-* attributes in HTML 5, have names that<br /> can’t be used as the names of keyword arguments:<br /> data_soup = BeautifulSoup(‘</p> <div data-foo="value">foo! </div> <p>‘, ”)<br /> nd_all(data-foo=”value”)<br /> # SyntaxError: keyword can’t be an expression<br /> You can use these attributes in searches by putting them into a<br /> dictionary and passing the dictionary into find_all() as the<br /> attrs argument:<br /> nd_all(attrs={“data-foo”: “value”})<br /> # [</p> <div data-foo="value">foo! </div> <p>]<br /> You can’t use a keyword argument to search for HTML’s ‘name’ element,<br /> because Beautiful Soup uses the name argument to contain the name<br /> of the tag itself. Instead, you can give a value to ‘name’ in the<br /> name_soup = BeautifulSoup(‘<input name="email"/>‘, ”)<br /> nd_all(name=”email”)<br /> # []<br /> nd_all(attrs={“name”: “email”})<br /> # [<input name="email"/>]<br /> Searching by CSS class¶<br /> It’s very useful to search for a tag that has a certain CSS class, but<br /> the name of the CSS attribute, “class”, is a reserved word in<br /> Python. Using class as a keyword argument will give you a syntax<br /> error. As of Beautiful Soup 4. 1. 2, you can search by CSS class using<br /> the keyword argument class_:<br /> nd_all(“a”, class_=”sister”)<br /> As with any keyword argument, you can pass class_ a string, a regular<br /> expression, a function, or True:<br /> nd_all(mpile(“itl”))<br /> def has_six_characters(css_class):<br /> return css_class is not None and len(css_class) == 6<br /> nd_all(class_=has_six_characters)<br /> Remember that a single tag can have multiple<br /> values for its “class” attribute. When you search for a tag that<br /> matches a certain CSS class, you’re matching against any of its CSS<br /> classes:<br /> nd_all(“p”, class_=”strikeout”)<br /> # [</p> <p class="body strikeout"> <p>]<br /> nd_all(“p”, class_=”body”)<br /> You can also search for the exact string value of the class attribute:<br /> nd_all(“p”, class_=”body strikeout”)<br /> But searching for variants of the string value won’t work:<br /> nd_all(“p”, class_=”strikeout body”)<br /> If you want to search for tags that match two or more CSS classes, you<br /> should use a CSS selector:<br /> (“p. “)<br /> In older versions of Beautiful Soup, which don’t have the class_<br /> shortcut, you can use the attrs trick mentioned above. Create a<br /> dictionary whose value for “class” is the string (or regular<br /> expression, or whatever) you want to search for:<br /> nd_all(“a”, attrs={“class”: “sister”})<br /> The string argument¶<br /> With string you can search for strings instead of tags. As with<br /> name and the keyword arguments, you can pass in a string, a<br /> regular expression, a list, a function, or the value True.<br /> Here are some examples:<br /> nd_all(string=”Elsie”)<br /> # [‘Elsie’]<br /> nd_all(string=[“Tillie”, “Elsie”, “Lacie”])<br /> # [‘Elsie’, ‘Lacie’, ‘Tillie’]<br /> nd_all(mpile(“Dormouse”))<br /> # [“The Dormouse’s story”, “The Dormouse’s story”]<br /> def is_the_only_string_within_a_tag(s):<br /> “””Return True if this string is the only child of its parent tag. “””<br /> return (s ==)<br /> nd_all(string=is_the_only_string_within_a_tag)<br /> # [“The Dormouse’s story”, “The Dormouse’s story”, ‘Elsie’, ‘Lacie’, ‘Tillie’, ‘… ‘]<br /> Although string is for finding strings, you can combine it with<br /> arguments that find tags: Beautiful Soup will find all tags whose<br /> matches your value for string. This code finds the <a><br /> tags whose is “Elsie”:<br /> nd_all(“a”, string=”Elsie”)<br /> # [<a href=" class="sister" id="link1">Elsie</a>]<br /> The string argument is new in Beautiful Soup 4. 4. 0. In earlier<br /> versions it was called text:<br /> nd_all(“a”, text=”Elsie”)<br /> The limit argument¶<br /> find_all() returns all the tags and strings that match your<br /> filters. This can take a while if the document is large. If you don’t<br /> need all the results, you can pass in a number for limit. This<br /> works just like the LIMIT keyword in SQL. It tells Beautiful Soup to<br /> stop gathering results after it’s found a certain number.<br /> There are three links in the “three sisters” document, but this code<br /> only finds the first two:<br /> nd_all(“a”, limit=2)<br /> # <a class="sister" href=" id="link2">Lacie</a>]<br /> The recursive argument¶<br /> If you call nd_all(), Beautiful Soup will examine all the<br /> descendants of mytag: its children, its children’s children, and<br /> so on. If you only want Beautiful Soup to consider direct children,<br /> you can pass in recursive=False. See the differe<br /> <img decoding="async" src="https://proxyboys.net/wp-content/uploads/2021/12/variable-puzzles.jpg" alt="Web Scraping and Parsing HTML in Python with Beautiful Soup" title="Web Scraping and Parsing HTML in Python with Beautiful Soup" /></p> <h2>Web Scraping and Parsing HTML in Python with Beautiful Soup</h2> <p>The internet has an amazingly wide variety of information for human consumption. But this data is often difficult to access programmatically if it doesn’t come in the form of a dedicated REST API. With Python tools like Beautiful Soup, you can scrape and parse this data directly from web pages to use for your projects and applications.<br /> Let’s use the example of scraping MIDI data from the internet to train a neural network with Magenta that can generate classic Nintendo-sounding music. In order to do this, we’ll need a set of MIDI music from old Nintendo games. Using Beautiful Soup we can get this data from the Video Game Music Archive.<br /> Getting started and setting up dependencies<br /> Before moving on, you will need to make sure you have an up to date version of Python 3 and pip installed. Make sure you create and activate a virtual environment before installing any dependencies.<br /> You’ll need to install the Requests library for making HTTP requests to get data from the web page, and Beautiful Soup for parsing through the HTML.<br /> With your virtual environment activated, run the following command in your terminal:<br /> pip install requests==2. 22. 0 beautifulsoup4==4. 8. 1<br /> We’re using Beautiful Soup 4 because it’s the latest version and Beautiful Soup 3 is no longer being developed or supported.<br /> Using Requests to scrape data for Beautiful Soup to parse<br /> First let’s write some code to grab the HTML from the web page, and look at how we can start parsing through it. The following code will send a GET request to the web page we want, and create a BeautifulSoup object with the HTML from that page:<br /> import requests<br /> from bs4 import BeautifulSoup<br /> vgm_url = ”<br /> html_text = (vgm_url)<br /> soup = BeautifulSoup(html_text, ”)<br /> With this soup object, you can navigate and search through the HTML for data that you want. For example, if you run after the previous code in a Python shell you’ll get the title of the web page. If you run print(t_text()), you will see all of the text on the page.<br /> Getting familiar with Beautiful Soup<br /> The find() and find_all() methods are among the most powerful weapons in your arsenal. () is great for cases where you know there is only one element you’re looking for, such as the body tag. On this page, (id=’banner_ad’) will get you the text from the HTML element for the banner advertisement.<br /> nd_all() is the most common method you will be using in your web scraping adventures. Using this you can iterate through all of the hyperlinks on the page and print their URLs:<br /> for link in nd_all(‘a’):<br /> print((‘href’))<br /> You can also provide different arguments to find_all, such as regular expressions or tag attributes to filter your search as specifically as you want. You can find lots of cool features in the documentation.<br /> Parsing and navigating HTML with BeautifulSoup<br /> Before writing more code to parse the content that we want, let’s first take a look at the HTML that’s rendered by the browser. Every web page is different, and sometimes getting the right data out of them requires a bit of creativity, pattern recognition, and experimentation.<br /> Our goal is to download a bunch of MIDI files, but there are a lot of duplicate tracks on this webpage as well as remixes of songs. We only want one of each song, and because we ultimately want to use this data to train a neural network to generate accurate Nintendo music, we won’t want to train it on user-created remixes.<br /> When you’re writing code to parse through a web page, it’s usually helpful to use the developer tools available to you in most modern browsers. If you right-click on the element you’re interested in, you can inspect the HTML behind that element to figure out how you can programmatically access the data you want.<br /> Let’s use the find_all method to go through all of the links on the page, but use regular expressions to filter through them so we are only getting links that contain MIDI files whose text has no parentheses, which will allow us to exclude all of the duplicates and remixes.<br /> Create a file called and add the following code to it:<br /> import re<br /> if __name__ == ‘__main__’:<br /> attrs = {<br /> ‘href’: mpile(r’\$’)}<br /> tracks = nd_all(‘a’, attrs=attrs, mpile(r’^((?! \(). )*$’))<br /> count = 0<br /> for track in tracks:<br /> print(track)<br /> count += 1<br /> print(len(tracks))<br /> This will filter through all of the MIDI files that we want on the page, print out the link tag corresponding to them, and then print how many files we filtered.<br /> Run the code in your terminal with the command python<br /> Downloading the MIDI files we want from the webpage<br /> Now that we have working code to iterate through every MIDI file that we want, we have to write code to download all of them.<br /> In, add a function to your code called download_track, and call that function for each track in the loop iterating through them:<br /> def download_track(count, track_element):<br /> # Get the title of the track from the HTML element<br /> track_title = (). replace(‘/’, ‘-‘)<br /> download_url = ‘{}{}'(vgm_url, track_element[‘href’])<br /> file_name = ‘{}_{}'(count, track_title)<br /> # Download the track<br /> r = (download_url, allow_redirects=True)<br /> with open(file_name, ‘wb’) as f:<br /> (ntent)<br /> # Print to the console to keep track of how the scraping is coming along.<br /> print(‘Downloaded: {}'(track_title, download_url))<br /> download_track(count, track)<br /> In this download_track function, we’re passing the Beautiful Soup object representing the HTML element of the link to the MIDI file, along with a unique number to use in the filename to avoid possible naming collisions.<br /> Run this code from a directory where you want to save all of the MIDI files, and watch your terminal screen display all 2230 MIDIs that you downloaded (at the time of writing this). This is just one specific practical example of what you can do with Beautiful Soup.<br /> The vast expanse of the World Wide Web<br /> Now that you can programmatically grab things from web pages, you have access to a huge source of data for whatever your projects need. One thing to keep in mind is that changes to a web page’s HTML might break your code, so make sure to keep everything up to date if you’re building applications on top of this.<br /> If you’re looking for something to do with the data you just grabbed from the Video Game Music Archive, you can try using Python libraries like Mido to work with MIDI data to clean it up, or use Magenta to train a neural network with it or have fun building a phone number people can call to hear Nintendo music.<br /> I’m looking forward to seeing what you build. Feel free to reach out and share your experiences or ask any questions.<br /> Email:<br /> Twitter: @Sagnewshreds<br /> Github: Sagnew<br /> Twitch (streaming live code): Sagnewshreds</p> <h2>Frequently Asked Questions about parse html beautifulsoup</h2> <h3>How do I parse HTML in Python?</h3> <p>Examplefrom html. parser import HTMLParser.class Parser(HTMLParser):# method to append the start tag to the list start_tags.def handle_starttag(self, tag, attrs):global start_tags.start_tags. append(tag)# method to append the end tag to the list end_tags.def handle_endtag(self, tag):More items…</p> <h3>How do I open a HTML file in BeautifulSoup?</h3> <p>Python: Parse an Html File Using Beautifulsoupfrom bs4 import BeautifulSoup with open(‘files/file1.html’) as f: #read File content = f. read() #parse HTML soup = BeautifulSoup(content, ‘html.parser’) #print Title tag print(soup. … f = open(‘file.html’) content = f. … import glob files = glob.Apr 28, 2021</p> <h3>How do I parse a website using BeautifulSoup?</h3> <p>First, we need to import all the libraries that we are going to use. Next, declare a variable for the url of the page. Then, make use of the Python urllib2 to get the HTML page of the url declared. Finally, parse the page into BeautifulSoup format so we can use BeautifulSoup to work on it.Jun 10, 2017</p> <div class="post-tags"> <a href="#">Tags: <a href="https://proxyboys.net/tag/beautifulsoup-documentation/" rel="tag">beautifulsoup documentation</a> <a href="https://proxyboys.net/tag/beautifulsoup-example/" rel="tag">beautifulsoup example</a> <a href="https://proxyboys.net/tag/beautifulsoup-find/" rel="tag">beautifulsoup find</a> <a href="https://proxyboys.net/tag/beautifulsoup-find-by-class/" rel="tag">beautifulsoup find by class</a> <a href="https://proxyboys.net/tag/beautifulsoup-find_all/" rel="tag">beautifulsoup find_all</a> <a href="https://proxyboys.net/tag/beautifulsoup-get-text-inside-tag/" rel="tag">beautifulsoup get text inside tag</a> <a href="https://proxyboys.net/tag/beautifulsoup-tutorial/" rel="tag">beautifulsoup tutorial</a> <a href="https://proxyboys.net/tag/python-html-parser/" rel="tag">python html parser</a><br /></a> </div> <div class="post-navigation"> <div class="post-prev"> <a href="https://proxyboys.net/proxy-server-polska/"> <div class="postnav-image"> <i class="fa fa-chevron-left"></i> <div class="overlay"></div> <div class="navprev"> <img width="960" height="718" src="https://proxyboys.net/wp-content/uploads/2021/11/proxy-4620558_960_720.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" srcset="https://proxyboys.net/wp-content/uploads/2021/11/proxy-4620558_960_720.jpg 960w, https://proxyboys.net/wp-content/uploads/2021/11/proxy-4620558_960_720-300x224.jpg 300w, https://proxyboys.net/wp-content/uploads/2021/11/proxy-4620558_960_720-768x574.jpg 768w, https://proxyboys.net/wp-content/uploads/2021/11/proxy-4620558_960_720-535x400.jpg 535w" sizes="(max-width: 960px) 100vw, 960px" /> </div> </div> <div class="prev-post-title"> <p><a href="https://proxyboys.net/proxy-server-polska/" rel="prev">Proxy Server Polska</a></p> </div> </a> </div> <div class="post-next"> <a href="https://proxyboys.net/proxymaster/"> <div class="postnav-image"> <i class="fa fa-chevron-right"></i> <div class="overlay"></div> <div class="navnext"> <img width="275" height="183" src="https://proxyboys.net/wp-content/uploads/2021/11/images-485.jpeg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" /> </div> </div> <div class="next-post-title"> <p><a href="https://proxyboys.net/proxymaster/" rel="next">Proxymaster</a></p> </div> </a> </div> </div> </div> </div> <div id="comments" class="comments-area"> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/parse-html-beautifulsoup/#respond" style="display:none;">Cancel reply</a></small></h3><form action="https://proxyboys.net/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate><p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p><p class="comment-form-comment"><label for="comment">Comment <span class="required">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required></textarea></p><p class="comment-form-author"><label for="author">Name <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" autocomplete="name" required /></p> <p class="comment-form-email"><label for="email">Email <span class="required">*</span></label> <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" autocomplete="email" required /></p> <p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="url" value="" size="30" maxlength="200" autocomplete="url" /></p> <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /> <label for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></p> <p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment" /> <input type='hidden' name='comment_post_ID' value='16585' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </p><p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="5d0325ef47" /></p><p style="display: none !important;"><label>Δ<textarea name="ak_hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label><input type="hidden" id="ak_js_1" name="ak_js" value="46"/><script>document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() );</script></p></form> </div><!-- #respond --> </div><!-- #comments --> </div> <div class="col-lg-4"> <aside id="secondary" class="widget-area"> <div id="search-2" class="widget sidebar-post sidebar widget_search"><form role="search" method="get" class="search-form" action="https://proxyboys.net/"> <label> <span class="screen-reader-text">Search for:</span> <input type="search" class="search-field" placeholder="Search …" value="" name="s" /> </label> <input type="submit" class="search-submit" value="Search" /> </form></div> <div id="recent-posts-2" class="widget sidebar-post sidebar widget_recent_entries"> <div class="sidebar-title"><h3 class="title mb-20">Recent Posts</h3></div> <ul> <li> <a href="https://proxyboys.net/how-to-know-if-my-ip-address-is-being-tracked/">How To Know If My Ip Address Is Being Tracked</a> </li> <li> <a href="https://proxyboys.net/how-can-you-change-your-ip-address/">How Can You Change Your Ip Address</a> </li> <li> <a href="https://proxyboys.net/is-a-public-ip-address-safe/">Is A Public Ip Address Safe</a> </li> <li> <a href="https://proxyboys.net/anonymous-firefox-android/">Anonymous Firefox Android</a> </li> <li> <a href="https://proxyboys.net/hong-kong-proxy-server/">Hong Kong Proxy Server</a> </li> <li> <a href="https://proxyboys.net/youtube-proxy-france/">Youtube Proxy France</a> </li> <li> <a href="https://proxyboys.net/how-to-scrape-linkedin/">How To Scrape Linkedin</a> </li> <li> <a href="https://proxyboys.net/post-ad-gumtree/">Post Ad Gumtree</a> </li> <li> <a href="https://proxyboys.net/4g-proxy-usa/">4G Proxy Usa</a> </li> <li> <a href="https://proxyboys.net/proxy-8082/">Proxy 8082</a> </li> </ul> </div><div id="tag_cloud-2" class="widget sidebar-post sidebar widget_tag_cloud"><div class="sidebar-title"><h3 class="title mb-20">Tags</h3></div><div class="tagcloud"><a href="https://proxyboys.net/tag/best-free-proxy/" class="tag-cloud-link tag-link-349 tag-link-position-1" style="font-size: 20pt;" aria-label="best free proxy (148 items)">best free proxy</a> <a href="https://proxyboys.net/tag/best-free-proxy-server-list/" class="tag-cloud-link tag-link-219 tag-link-position-2" style="font-size: 16pt;" aria-label="best free proxy server list (93 items)">best free proxy server list</a> <a href="https://proxyboys.net/tag/best-proxy-server/" class="tag-cloud-link tag-link-348 tag-link-position-3" style="font-size: 12.6pt;" aria-label="best proxy server (62 items)">best proxy server</a> <a href="https://proxyboys.net/tag/best-proxy-sites/" class="tag-cloud-link tag-link-948 tag-link-position-4" style="font-size: 10.2pt;" aria-label="best proxy sites (47 items)">best proxy sites</a> <a href="https://proxyboys.net/tag/best-vpn-to-hide-ip-address/" class="tag-cloud-link tag-link-964 tag-link-position-5" style="font-size: 8.2pt;" aria-label="best vpn to hide ip address (37 items)">best vpn to hide ip address</a> <a href="https://proxyboys.net/tag/craigslist-account-for-sale/" class="tag-cloud-link tag-link-2942 tag-link-position-6" style="font-size: 9.2pt;" aria-label="craigslist account for sale (42 items)">craigslist account for sale</a> <a href="https://proxyboys.net/tag/craigslist-homepage/" class="tag-cloud-link tag-link-306 tag-link-position-7" style="font-size: 12.2pt;" aria-label="craigslist homepage (59 items)">craigslist homepage</a> <a href="https://proxyboys.net/tag/craigslist-my-account-new-posting/" class="tag-cloud-link tag-link-166 tag-link-position-8" style="font-size: 9pt;" aria-label="craigslist my account new posting (41 items)">craigslist my account new posting</a> <a href="https://proxyboys.net/tag/free-proxy/" class="tag-cloud-link tag-link-1110 tag-link-position-9" style="font-size: 13pt;" aria-label="free proxy (65 items)">free proxy</a> <a href="https://proxyboys.net/tag/free-proxy-list/" class="tag-cloud-link tag-link-469 tag-link-position-10" style="font-size: 20.8pt;" aria-label="free proxy list (163 items)">free proxy list</a> <a href="https://proxyboys.net/tag/free-proxy-list-download/" class="tag-cloud-link tag-link-220 tag-link-position-11" style="font-size: 11pt;" aria-label="free proxy list download (52 items)">free proxy list download</a> <a href="https://proxyboys.net/tag/free-proxy-list-india/" class="tag-cloud-link tag-link-472 tag-link-position-12" style="font-size: 9.2pt;" aria-label="free proxy list india (42 items)">free proxy list india</a> <a href="https://proxyboys.net/tag/free-proxy-list-txt/" class="tag-cloud-link tag-link-148 tag-link-position-13" style="font-size: 13.8pt;" aria-label="free proxy list txt (72 items)">free proxy list txt</a> <a href="https://proxyboys.net/tag/free-proxy-list-usa/" class="tag-cloud-link tag-link-1759 tag-link-position-14" style="font-size: 9.2pt;" aria-label="free proxy list usa (42 items)">free proxy list usa</a> <a href="https://proxyboys.net/tag/free-proxy-server/" class="tag-cloud-link tag-link-577 tag-link-position-15" style="font-size: 11.6pt;" aria-label="free proxy server (55 items)">free proxy server</a> <a href="https://proxyboys.net/tag/free-proxy-server-list/" class="tag-cloud-link tag-link-142 tag-link-position-16" style="font-size: 17.2pt;" aria-label="free proxy server list (107 items)">free proxy server list</a> <a href="https://proxyboys.net/tag/free-socks-list-daily/" class="tag-cloud-link tag-link-931 tag-link-position-17" style="font-size: 13pt;" aria-label="free socks list daily (65 items)">free socks list daily</a> <a href="https://proxyboys.net/tag/free-vpn-to-hide-ip-address/" class="tag-cloud-link tag-link-960 tag-link-position-18" style="font-size: 15.8pt;" aria-label="free vpn to hide ip address (91 items)">free vpn to hide ip address</a> <a href="https://proxyboys.net/tag/free-web-proxy/" class="tag-cloud-link tag-link-626 tag-link-position-19" style="font-size: 10.2pt;" aria-label="free web proxy (47 items)">free web proxy</a> <a href="https://proxyboys.net/tag/hide-my-ip-address-free/" class="tag-cloud-link tag-link-815 tag-link-position-20" style="font-size: 13.8pt;" aria-label="hide my ip address free (71 items)">hide my ip address free</a> <a href="https://proxyboys.net/tag/hide-my-ip-address-free-online/" class="tag-cloud-link tag-link-4832 tag-link-position-21" style="font-size: 12.4pt;" aria-label="hide my ip address free online (61 items)">hide my ip address free online</a> <a href="https://proxyboys.net/tag/hide-my-ip-online/" class="tag-cloud-link tag-link-814 tag-link-position-22" style="font-size: 11.8pt;" aria-label="hide my ip online (57 items)">hide my ip online</a> <a href="https://proxyboys.net/tag/how-to-hide-my-ip-address-in-gmail/" class="tag-cloud-link tag-link-968 tag-link-position-23" style="font-size: 8.4pt;" aria-label="how to hide my ip address in gmail (38 items)">how to hide my ip address in gmail</a> <a href="https://proxyboys.net/tag/how-to-hide-my-ip-address-without-vpn/" class="tag-cloud-link tag-link-962 tag-link-position-24" style="font-size: 13pt;" aria-label="how to hide my ip address without vpn (65 items)">how to hide my ip address without vpn</a> <a href="https://proxyboys.net/tag/ip-address/" class="tag-cloud-link tag-link-961 tag-link-position-25" style="font-size: 9.2pt;" aria-label="ip address (42 items)">ip address</a> <a href="https://proxyboys.net/tag/ip-address-tracker/" class="tag-cloud-link tag-link-477 tag-link-position-26" style="font-size: 16pt;" aria-label="ip address tracker (92 items)">ip address tracker</a> <a href="https://proxyboys.net/tag/my-ip-country/" class="tag-cloud-link tag-link-965 tag-link-position-27" style="font-size: 11.8pt;" aria-label="my ip country (57 items)">my ip country</a> <a href="https://proxyboys.net/tag/proxy-browser/" class="tag-cloud-link tag-link-629 tag-link-position-28" style="font-size: 11.6pt;" aria-label="proxy browser (55 items)">proxy browser</a> <a href="https://proxyboys.net/tag/proxy-server/" class="tag-cloud-link tag-link-470 tag-link-position-29" style="font-size: 17.4pt;" aria-label="proxy server (109 items)">proxy server</a> <a href="https://proxyboys.net/tag/proxy-server-address/" class="tag-cloud-link tag-link-1611 tag-link-position-30" style="font-size: 14.2pt;" aria-label="proxy server address (74 items)">proxy server address</a> <a href="https://proxyboys.net/tag/proxy-server-address-ps4/" class="tag-cloud-link tag-link-365 tag-link-position-31" style="font-size: 8.4pt;" aria-label="proxy server address ps4 (38 items)">proxy server address ps4</a> <a href="https://proxyboys.net/tag/proxy-server-example/" class="tag-cloud-link tag-link-350 tag-link-position-32" style="font-size: 9.2pt;" aria-label="proxy server example (42 items)">proxy server example</a> <a href="https://proxyboys.net/tag/proxy-site/" class="tag-cloud-link tag-link-351 tag-link-position-33" style="font-size: 10.8pt;" aria-label="proxy site (50 items)">proxy site</a> <a href="https://proxyboys.net/tag/proxy-url-list/" class="tag-cloud-link tag-link-2011 tag-link-position-34" style="font-size: 10.8pt;" aria-label="proxy url list (50 items)">proxy url list</a> <a href="https://proxyboys.net/tag/proxy-websites/" class="tag-cloud-link tag-link-627 tag-link-position-35" style="font-size: 15.2pt;" aria-label="proxy websites (85 items)">proxy websites</a> <a href="https://proxyboys.net/tag/socks5-proxy-list/" class="tag-cloud-link tag-link-131 tag-link-position-36" style="font-size: 8pt;" aria-label="socks5 proxy list (36 items)">socks5 proxy list</a> <a href="https://proxyboys.net/tag/socks5-proxy-list-txt/" class="tag-cloud-link tag-link-518 tag-link-position-37" style="font-size: 11pt;" aria-label="socks5 proxy list txt (52 items)">socks5 proxy list txt</a> <a href="https://proxyboys.net/tag/thepiratebay3-list/" class="tag-cloud-link tag-link-16 tag-link-position-38" style="font-size: 8.2pt;" aria-label="thepiratebay3 list (37 items)">thepiratebay3 list</a> <a href="https://proxyboys.net/tag/unblock-proxy-free/" class="tag-cloud-link tag-link-316 tag-link-position-39" style="font-size: 22pt;" aria-label="unblock proxy free (185 items)">unblock proxy free</a> <a href="https://proxyboys.net/tag/unblock-proxy-sites-list/" class="tag-cloud-link tag-link-4596 tag-link-position-40" style="font-size: 8.2pt;" aria-label="unblock proxy sites list (37 items)">unblock proxy sites list</a> <a href="https://proxyboys.net/tag/utorrent-download/" class="tag-cloud-link tag-link-1167 tag-link-position-41" style="font-size: 11pt;" aria-label="utorrent download (51 items)">utorrent download</a> <a href="https://proxyboys.net/tag/vpn-proxy/" class="tag-cloud-link tag-link-585 tag-link-position-42" style="font-size: 9pt;" aria-label="vpn proxy (41 items)">vpn proxy</a> <a href="https://proxyboys.net/tag/what-is-a-proxy-server/" class="tag-cloud-link tag-link-74 tag-link-position-43" style="font-size: 9.2pt;" aria-label="what is a proxy server (42 items)">what is a proxy server</a> <a href="https://proxyboys.net/tag/what-is-my-ip/" class="tag-cloud-link tag-link-816 tag-link-position-44" style="font-size: 13.2pt;" aria-label="what is my ip (67 items)">what is my ip</a> <a href="https://proxyboys.net/tag/what-is-my-private-ip/" class="tag-cloud-link tag-link-959 tag-link-position-45" style="font-size: 11pt;" aria-label="what is my private ip (51 items)">what is my private ip</a></div> </div></aside> </div> </div> </div> </section> </div><!-- #content --> <footer class="footer-section-child"> <div class="container"> <div class="footer-top"> <div class="row clearfix"> <div class="widget_text widget_custom_html footer-widget col-md-3 col-sm-6 col-xs-12"><div class="textwidget custom-html-widget"><!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-9TFKENNJT0"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-9TFKENNJT0'); </script></div></div> </div> </div> </div> <div class="copyright-footer-child"> <div class="container"> <div class="row justify-content-center"> <div class="col-md-6 text-md-center align-self-center"> <p>Copyright 2021 ProxyBoys</p> </div> </div> </div> </div> </footer> </div><!-- #page --> <button onclick="blogwavesTopFunction()" id="myBtn" title="Go to top"> <i class="fa fa-angle-up"></i> </button> <link rel='stylesheet' id='aal_style-css' href='https://proxyboys.net/wp-content/plugins/wp-auto-affiliate-links/css/style.css?ver=6.3.1' media='all' /> <script src='https://proxyboys.net/wp-content/plugins/accordion-slider-gallery/assets/js/accordion-slider-js.js?ver=2.6' id='jquery-accordion-slider-js-js'></script> <script src='https://proxyboys.net/wp-content/plugins/blog-manager-wp/assets/js/designer.js?ver=6.3.1' id='wp-pbsm-script-js'></script> <script src='https://proxyboys.net/wp-content/plugins/photo-gallery-builder/assets/js/lightbox.min.js?ver=2.9' id='photo_gallery_lightbox2_script-js'></script> <script src='https://proxyboys.net/wp-content/plugins/photo-gallery-builder/assets/js/packery.min.js?ver=2.9' id='photo_gallery_packery-js'></script> <script src='https://proxyboys.net/wp-content/plugins/photo-gallery-builder/assets/js/isotope.pkgd.js?ver=2.9' id='photo_gallery_isotope-js'></script> <script src='https://proxyboys.net/wp-content/plugins/photo-gallery-builder/assets/js/imagesloaded.pkgd.min.js?ver=2.9' id='photo_gallery_imagesloaded-js'></script> <script src='https://proxyboys.net/wp-includes/js/imagesloaded.min.js?ver=4.1.4' id='imagesloaded-js'></script> <script src='https://proxyboys.net/wp-includes/js/masonry.min.js?ver=4.2.2' id='masonry-js'></script> <script src='https://proxyboys.net/wp-content/themes/blogwaves/assets/js/navigation.js?ver=1.0.0' id='blogwaves-navigation-js'></script> <script src='https://proxyboys.net/wp-content/themes/blogwaves/assets/js/popper.js?ver=1.0.0' id='popper-js-js'></script> <script src='https://proxyboys.net/wp-content/themes/blogwaves/assets/js/bootstrap.js?ver=1.0.0' id='bootstrap-js-js'></script> <script src='https://proxyboys.net/wp-content/themes/blogwaves/assets/js/main.js?ver=1.0.0' id='blogwaves-main-js-js'></script> <script src='https://proxyboys.net/wp-content/themes/blogwaves/assets/js/skip-link-focus-fix.js?ver=1.0.0' id='skip-link-focus-fix-js-js'></script> <script src='https://proxyboys.net/wp-content/themes/blogwaves/assets/js/global.js?ver=1.0.0' id='blogwaves-global-js-js'></script> <script src='https://proxyboys.net/wp-includes/js/comment-reply.min.js?ver=6.3.1' id='comment-reply-js'></script> <script defer src='https://proxyboys.net/wp-content/plugins/akismet/_inc/akismet-frontend.js?ver=1694678589' id='akismet-frontend-js'></script> <script>!function(){window.advanced_ads_ready_queue=window.advanced_ads_ready_queue||[],advanced_ads_ready_queue.push=window.advanced_ads_ready;for(var d=0,a=advanced_ads_ready_queue.length;d<a;d++)advanced_ads_ready(advanced_ads_ready_queue[d])}();</script> </body> </html>