Conteúdo do Curso
Automating Data Collection from Web Sources
Extract the Desired Attribute
For this chapter, we are going to extract some relevant statistics from a web page. In order to do so, you are going to need some kind of knowledge about the structure of the target HTML webpage.
A web page is typically made up of several different types of content, including text, images, and multimedia. These elements are all contained within HTML (HyperText Markup Language) tags, which define the structure and layout of the content on the page.
The basic building blocks of an HTML page are elements, which are represented by tags. These tags are used to mark up the content of the page, indicating to the web browser how it should be displayed. Some common HTML elements include headings, paragraphs, lists, links, and images.
In addition to these core elements, a web page can also include other types of content, such as CSS (Cascading Style Sheets) and JavaScript, which are used to control the appearance and behavior of the page.
Overall, an HTML page is a combination of text, images, and other content, all organized and structured using HTML tags and potentially enhanced with CSS and JavaScript.
Swipe to show code editor
- Use the
BeautifulSoup
library to parse the content of the FAO website. - Get the content of the first div element with the following class:
"col-md-4 country"
. - Get the content of the immediate sibling of the tag we found earlier on.
Obrigado pelo seu feedback!
For this chapter, we are going to extract some relevant statistics from a web page. In order to do so, you are going to need some kind of knowledge about the structure of the target HTML webpage.
A web page is typically made up of several different types of content, including text, images, and multimedia. These elements are all contained within HTML (HyperText Markup Language) tags, which define the structure and layout of the content on the page.
The basic building blocks of an HTML page are elements, which are represented by tags. These tags are used to mark up the content of the page, indicating to the web browser how it should be displayed. Some common HTML elements include headings, paragraphs, lists, links, and images.
In addition to these core elements, a web page can also include other types of content, such as CSS (Cascading Style Sheets) and JavaScript, which are used to control the appearance and behavior of the page.
Overall, an HTML page is a combination of text, images, and other content, all organized and structured using HTML tags and potentially enhanced with CSS and JavaScript.
Swipe to show code editor
- Use the
BeautifulSoup
library to parse the content of the FAO website. - Get the content of the first div element with the following class:
"col-md-4 country"
. - Get the content of the immediate sibling of the tag we found earlier on.