Web Scraping - find CHEAP flights with Playwright

  Рет қаралды 9,534

CodeWithOsvaldas

CodeWithOsvaldas

Күн бұрын

In this video, I show you how to build a Web Scraper using Node.js
Web scraping is used to extract data from any website. We will be scraping cheap flight tickets using Playwright. Playwright is Puppeteer alternative. You can find more information & documentation about Playwright here playwright.dev/
💻Project code on Github: github.com/Cod...

Пікірлер: 25
@nickstanovic
@nickstanovic Жыл бұрын
Thank you! I'm just learning web scraping with NodeJS and Playwright. Your explanation and demonstration is so good that I don't need to watch any other video!
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Thank you so much!! I really appreciate your comment!
@JaKi052
@JaKi052 Жыл бұрын
Very cool! I am new to dev and I always wondered how sites found cheap flights... Scotts Cheap flights and secrety flying for example. I figured it cant be all done manually. Will need some practise before learning this. Cheers!
@pascallermit3200
@pascallermit3200 Жыл бұрын
Thanks a lot for this video Osvaldas ! Really informative, starting Playwright I'm trying to go further in this example of flight ticket, do you have any discord to discuss about code, ideas etc... ?
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Thanks! feel free to leave comments here on youtube video or create an issue at github.com/CodeWithOsvaldas/webscraping-playwright-flight-tickets/issues
@Fodela
@Fodela Жыл бұрын
Thanks for an amazing video. 🙏
@olegkolesnik7710
@olegkolesnik7710 Жыл бұрын
Hey, buddy! I'm amazed at how quickly you're able to scrape! You managed to complete eight cycles in just 10 seconds of waiting time. That's pretty impressive! However, I'd like to point out that true web scraping involves more than just completing one task. It usually involves scraping multiple web pages or performing repetitive tasks. Keep up the good work, though!
@jsogman
@jsogman 5 ай бұрын
hello, Im brand new to Javascript and doing anything with the web and not sure: why is the JSON module process is necessary?
@Malathsam1994
@Malathsam1994 8 ай бұрын
Can you please help me, I need to login into a page and do something similar what you did. How can I store the cookies every time because I get session timeout when I try to consume the http request manually using Insomnia
@codewithosvaldas
@codewithosvaldas 8 ай бұрын
You are using the playwright for the login, right? If that is the case, you can try to retrieve the cookies by await page.context().cookies() and set them with addCookies(). More documentation: playwright.dev/docs/api/class-browsercontext#browser-context-add-cookies playwright.dev/docs/api/class-browsercontext#browser-context-cookies
@idcemail123
@idcemail123 Жыл бұрын
I scraped a site with playwright inside my express js app.get() function. How would i deploy this scraped data to a website such as vercel? It works locally but when i try to host it on heroku i just get error 500 ?
@soyebpatel2994
@soyebpatel2994 Жыл бұрын
How are you getting the helptext to appear. For example min 1.21, the timeout and url info when you filling the info out.
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Hey, could you clarify the question? What do you mean by helptext? :)
@mauriciobavaresco2055
@mauriciobavaresco2055 Жыл бұрын
Good content, would you know if it is possible to use playwright inspector for scrapy, without test ?
@codewithosvaldas
@codewithosvaldas 7 ай бұрын
Not familiar with scrapy yet :)
@matiasb4662
@matiasb4662 Жыл бұрын
Thank you for your video. How can you bypass a site that blocks you?
@codewithosvaldas
@codewithosvaldas 7 ай бұрын
That is tricky, so it depends :) first thing I would reach to is rotating proxies
@AD-ey1gt
@AD-ey1gt Жыл бұрын
hey, my pngs are not downloading. do I have to specify the path for that?
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Hey, are you referring to the screenshots? Yes, you have to give it a path where to save the png. For example, await cheapestFlightCardLocator.screenshot({ path: `${from} ${to}(${city})-${actualPrice}.png` }); or simply await cheapestFlightCardLocator.screenshot({ path: 'my-screenshot.png' }); Are you getting any errors? It can be that your locator is empty? You can double check that by consoling out the inner html of your locator like so: const innerHtml = await myLocator.innerHTML(); console.log(innerHtml)
@indirarath1092
@indirarath1092 Жыл бұрын
Hi, Thank you for the video. However, I am getting the following 'Microsoft.Playwright.PlaywrightException HResult=0x80131500 Message=Error: strict mode violation: Locator("div[data-test='ResultCardWrapper']") resolved to 3. Can you help resolve this ?
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Hey, sure! The Locator API is strict, meaning if it finds more than one element with your selector and you try to call a locator, like .click(), it will throw an error. To avoid that you could loop through all 3 elements or just add .first() for e.x. const cheapestFlightCardLocator = page.locator('[data-test=ResultCardWrapper]').first(); You can check out the code here github.com/CodeWithOsvaldas/webscraping-playwright-flight-tickets
@indirarath1092
@indirarath1092 Жыл бұрын
@@codewithosvaldas Thank you for the response. I had figured that out eventually and resolved the issue.
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Nice! So did you managed to scrape some tickets?
@aksharagupta9699
@aksharagupta9699 Жыл бұрын
Hi ,which software are u using ?
@codewithosvaldas
@codewithosvaldas Жыл бұрын
Hi, for what?
Scraping with Playwright 101 - Easy Mode
19:56
John Watson Rooney
Рет қаралды 10 М.
EASIEST way to web scraping using Playwright!
29:15
Marius Espejo
Рет қаралды 14 М.
小丑和白天使的比试。#天使 #小丑 #超人不会飞
00:51
超人不会飞
Рет қаралды 41 МЛН
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 49 МЛН
Web Scraping with ChatGPT is mind blowing 🤯
8:03
Code Bear
Рет қаралды 48 М.
It's 100% FREE Now!! Scrape ANY WEBSITE with Llama3.1!
13:24
Reda Marzouk
Рет қаралды 13 М.
A Guide to Web Scraping with Node.js
9:54
Fireship
Рет қаралды 379 М.
How to find the CHEAPEST flights on Google Flights! (Money Saving Guaranteed)
15:52
Best Web Scraping Combo? Use These In Your Projects
20:13
John Watson Rooney
Рет қаралды 43 М.
Learn Web Scraping with Playwright [Complete Course]
34:17
Kaniel Outis
Рет қаралды 2,9 М.
Web Scraping AI AGENT, that absolutely works 😍
11:22
1littlecoder
Рет қаралды 19 М.
Web Scraping to CSV | Multiple Pages Scraping with BeautifulSoup
29:06
Why Beautiful Websites Don’t Convert
12:57
Malewicz
Рет қаралды 85 М.
UI Libraries Are Dying, Here's Why
13:28
Theo - t3․gg
Рет қаралды 310 М.
小丑和白天使的比试。#天使 #小丑 #超人不会飞
00:51
超人不会飞
Рет қаралды 41 МЛН