Rayrun
← Back to videos

Calculate Youtube Playlist Duration | Web Scraping | Playwright Tutorial - Part 41

Web Scraping:

This video is a tutorial on web scraping using the Playwright library in Python. The speaker explains that web scraping is the process of extracting data from web pages, which is useful for collecting information from various sources. The tutorial focuses on scraping data from a website that displays the number of videos and their durations for each playlist.

The speaker starts by importing the necessary libraries and creating an async function. They then define a URL and use the Playwright's go_to function to navigate to the webpage. Next, they use a CSS selector to find all the elements containing the video durations and store them in a variable.

The speaker then uses a map function to iterate over each video element and extract the duration text. They split the duration into minutes and seconds and convert them into numbers. After calculating the total minutes, they use a formula to convert the minutes into hours, minutes, and seconds. The calculated total time is printed to the console.

To demonstrate scraping data from different playlists, the speaker creates an array of URLs and uses a forEach loop to iterate over them. They use the URL of each playlist in the scraping process, allowing for the extraction of data from multiple playlists.

The speaker concludes the tutorial by mentioning that the code will be uploaded to GitHub for reference.

Related Videos

#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
Element Handle VS Locator API | Playwright Tutorial - Part 47
Element Handle VS Locator API | Playwright Tutorial - Part 47
Playwright Version 1.14 | Playwright Tutorial - Part 45
Playwright Version 1.14 | Playwright Tutorial - Part 45
First Script - Auto Waits | Playwright - Part 3
First Script - Auto Waits | Playwright - Part 3
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].