Hi,
and welcome to this module where we'll use Beautiful
Soup to navigate the parse tree.
We'll see how Beautiful Soup sets up a hierarchical
structure of the HTML content.
It builds a parse tree.
You can then navigate this parse tree using tag names that will
allow you to access certain tags directly.
Once you've accessed a certain node within your HTML parse tree,
Beautiful Soup allows you to traverse down the parse
tree by accessing your children, as well as your descendants.
In this context,
we'll understand the differences between child nodes and descendant nodes.
We'll also see how we can traverse up the parse tree to
access parent nodes and ancestor nodes.
We'll access child nodes, parent nodes, as well as sibling nodes and elements.
Accessing sibling nodes allows you to navigate the parse tree sideways,
left and right, that's a better way to imagine it.
We'll see how you can perform filtering operations on HTML elements using tags,
attributes, regular expressions, and custom functions.
And we'll put all of this together and see how we
can extract links from web pages.