Тёмный
No video :(

How to use puppeteer on Google Cloud Functions 

Jarrod Overson
Подписаться 5 тыс.
Просмотров 18 тыс.
50% 1

Опубликовано:

 

26 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 53   
@SimranjeetSingh-zv4xe
@SimranjeetSingh-zv4xe 3 года назад
I have watched millions of videos on RU-vid, Udemy and other platforms but this was probably the best in terms of information, fun and engagement. Incredible work man, Cheers!
@planetmall2
@planetmall2 5 лет назад
Great video. Thank you for continuing to make these!
@jsoverson
@jsoverson 5 лет назад
Puppeteer on cloud functions + the devtools protocol can allow you to turn clever devtools hacks into a full HTTP API endpoint.
@cdac1645
@cdac1645 4 года назад
Please make more videos on this subject. Like cloud functions with parameters and issues with CORS.
@sanjayajanakantha7883
@sanjayajanakantha7883 6 месяцев назад
Thank you Jarrod! It works for me and ur save my day! I realize that we are not always suppose to use latest versions
@timdowd
@timdowd Год назад
New versions of puppeteer no longer work in google cloud functions due to dependency issues. So now you need puppeteer to be in a container unfortunately... The puppeteer docs recommend cloud run
@riverbrooks2822
@riverbrooks2822 5 лет назад
Super informational video, great stuff!
@jsoverson
@jsoverson 5 лет назад
Thanks River!
@gfinzer
@gfinzer 4 года назад
Jarrod, you are simply the best.
@mattorrock4844
@mattorrock4844 3 года назад
Thanks, but could you do a video that shows how to use these functions from within say, a React project? For example, I'm working within an existing React project and used firebase init within the root dir, which creates the functions folder. The firebase deploy command looks for functions inside that folder, and the syntax you show here won't work. Any help? Would be an awesome vid, thanks!
@dionvansevenant6801
@dionvansevenant6801 4 года назад
Very interesting. Good explanations. However, I have poked at a few of your other videos and haven't found a reference to your kickstart script yet. Did you show the whole thing around 1:02 of this video, or just a snippet? Thanks!
@jsoverson
@jsoverson 4 года назад
Yeah it's very short and I have a few for different types of projects (e.g. rust, typescript). You can check it out here twitter.com/jsoverson/status/1097881605824237569?s=19
@dionvansevenant6801
@dionvansevenant6801 4 года назад
@@jsoverson cool. Thanks. Doesn't seem to work on Debian under WSL (Windows Subsystem for Linux), but that's ok. I get the intent and idea of it and can poke around with it when I get the chance.
@jasonc6241992
@jasonc6241992 Год назад
You sure you don't want to close both the context and browser? My script ends in a blank tab if i just close the context.
@cnikolov
@cnikolov 4 года назад
Do you need the close the browser when doing this? As well or the function will do it when the response is returned
@dazlave
@dazlave Год назад
I could be totally wrong, but would it not be important to close the browser and context resources to keep billing costs down?
@gijovarghese7548
@gijovarghese7548 4 года назад
How long will the Puppeteer instance be running? So even if we execute many cloud functions in parallel, those all use the same puppeteer instance?
@jl-dq5ch
@jl-dq5ch 4 года назад
That what it looks like. I'm currently having a problem where it runs the same request twice at about the same time. The only neat thing about that is that it seems to show that that one instance is used to run both queries.
@planetmall2
@planetmall2 5 лет назад
Jarrod, have you ever run into this error when running puppeteer on a function? Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r674921. I have tried to adjust the runtime environment between 8 and 10 and also changed the args to all the examples on the API. I get the same error no matter what. Any help would be great! Thanks again!
@jsoverson
@jsoverson 5 лет назад
I have but not recently. What version of puppeteer+chrome? Is it a bundled chrome? Is this locally or on GCP?
@planetmall2
@planetmall2 5 лет назад
@@jsoverson puppeteer: "1.19.0" - I am using it with a Firebase function. It looks like the internet has recently had that same issue.
@jsoverson
@jsoverson 5 лет назад
@@planetmall2 No I haven't seen that yet. 1.19 was what I used in the video and that worked (I just tried again). Maybe chrome isn't starting properly for some other reason? Is this new behavior or the first time you've tried it? Try some of the following args: --disable-gpu, --disable-dev-shm-usage, --disable-setuid-sandbox, --no-first-run, --no-zygote.
@planetmall2
@planetmall2 5 лет назад
@@jsoverson I tried a few different versions for the args with no luck. I will continue to diagnose.
@thomasstarzynski6787
@thomasstarzynski6787 4 года назад
did you find a solve for that by now? I'm having the same one. It seems like this is a common issue if you check on github: github.com/puppeteer/puppeteer/issues/4796
@Cdswjp
@Cdswjp 3 года назад
how can we determine what an appropriate memory size for our function will be?
@thecyrusj13
@thecyrusj13 4 года назад
This runs fine locally but I get Error: could not handle the request when I go to the url in the cloud
@thecyrusj13
@thecyrusj13 4 года назад
Sorry, my mistake. I didn't have billing enabled.
@thecyrusj13
@thecyrusj13 4 года назад
@@darekdede1995 Rather than using Google Cloud services I ultimately just used AWS which I'm used to. If you're interested in the AWS Lambda route for using Puppeteer see: github.com/alixaxel/chrome-aws-lambda
@ffgcvs
@ffgcvs 3 года назад
Can I use the same idea for running puppeteer on cloud functions with a logged area like GMP (Google Marketing Platform)? I have a local script in nodejs which does this job, but I need to run manually every day
@knsakib
@knsakib 4 года назад
The github repo is not accessible. Can you please check?
@rafaelbarros719
@rafaelbarros719 2 года назад
can i make it without headless mode?
@jatinrai199
@jatinrai199 2 года назад
You're awesome ! Keep it up. Subscribed your channel. Please post more videos on puppeteer.
@aarong9327
@aarong9327 3 года назад
This is scary powerful.
@phpmysql2007
@phpmysql2007 3 года назад
NICE! got mine to work too!
@mauroleonardosabatellidemo3619
Thank you my friend
@jl-dq5ch
@jl-dq5ch 4 года назад
I have the browser running with headless: false so that I can see whats going on and it seems like it is launching the browser twice using the same query: Am I doing something wrong? If I remove the res.end()/.send() it only runs once but then I am unable to deploy... exports.zillowScraper = async (req, res) => { const url = req.query.location ?`www.zillow.com/homes/${req.query.location}` : "www.zillow.com/homes/92259/" const browser = await browserPromise const context = await browser.createIncognitoBrowserContext() const page = await context.newPage() await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36') zillowScraper(page, url, context) res.end() }
@theseanmodd
@theseanmodd 3 года назад
THANK YOU
@tzarinadeabreu2507
@tzarinadeabreu2507 Год назад
Jarrod, tens este vídeo com legenda para a língua Portuguesa do Brasil? Muito obrigada!😉
@phantazzor
@phantazzor 3 года назад
Wow no need of express!?
@leopoldocouto
@leopoldocouto 5 лет назад
Hello Jarrod! How do I display, in my index.html, a return message from a function (using puppeteer) from another .js file? For example: I have an index.html page, and an index.js. In index.js I have a function that returns data taken from any page using Puppeteer. And I would like to display this message as a on my index.html page. Thanks for your attention and great videos. * sorry for gooleTranslate's english
@jsoverson
@jsoverson 5 лет назад
Can you elaborate? Like via AJAX on a regular webpage?
@leopoldocouto
@leopoldocouto 5 лет назад
@@jsoverson Im trying tô develop. The code in puppetter os ready. Now, i have to display the function return in HTML. But i dont know how
@jsoverson
@jsoverson 5 лет назад
That's a tough problem to solve without knowing much of the app. Are you returning the data as json?
@leopoldocouto
@leopoldocouto 5 лет назад
@@jsoverson I can return the data anyway. About the app, it's simple, there's only one .js file where I use puppeteer to enter, log in and extract data. And I wanted to display this data in an html page. Is there another better method of doing this?
@jsoverson
@jsoverson 5 лет назад
@@leopoldocouto you can return html directly from the function if you want to. You can treat it like a normal express app so you can use any template system you want (like handlebars). If you are returning it as json you will need a separate html file to call your function via XHR or Fetch and render it that way. If I've misunderstood the question, can you upload an example of the problem to GitHub?
@arthigo
@arthigo 3 года назад
"A Gigabyte of RAM Should Do the Trick"
@riverbrooks2822
@riverbrooks2822 4 года назад
Your subscribers (I) are hungry for content!! Haha xD
@jsoverson
@jsoverson 4 года назад
😖 I've been traveling and it's beating me up. I probably am still one week out until the next one. What should it be on? I've got puppeteer stuff, deepfake stuff, reverse engineering, GCP stuff, attack tools. There's a lot on the backlog.
@riverbrooks2822
@riverbrooks2822 4 года назад
@@jsoverson Good question. I'll give an answer to that question shortly.
@riverbrooks2822
@riverbrooks2822 4 года назад
@@jsoverson attack tools or puppeteer stuff, personally I think.
Далее
Web Scraping with Puppeteer, NodeJS & Shopify
27:54
Просмотров 66 тыс.
Web Scraping  With Javascript (Puppeteer Tutorial)
43:35
What is Puppeteer? Weekly npm Package Highlights
10:03
Puppeteer vs Selenium: Which to Choose
8:01
Просмотров 2,1 тыс.
Coding a Web Server in 25 Lines - Computerphile
17:49
Просмотров 334 тыс.