Sadly scratchpad is going away soon. Fortunately the console now has a multiline mode, unfortunately it's not as convenient for this use.
I only use an iFrame to crawl and scrape content
21–30 of 53 posts
Re: I only use an iFrame to crawl and scrape content
#22Re: I only use an iFrame to crawl and scrape content
#23Re: I only use an iFrame to crawl and scrape content
#24Won't the same origin policy kick in the moment I try to read the content of an iframe that isn't on the same origin as my website? Or is this meant to run on the dev console on the target website? In which case, the iFrame and the Airovic website doesn't make sense (the electron app mentioned does sure, but it doesn't exist)
That was my thinking as well. You cannot access another website's content opened via iframe via Javascript at all.
That's at least what it looked like from his examples.
Re: I only use an iFrame to crawl and scrape content
#25Okay, the way I see this is that using headless tools like puppeteer or selenium is tedious; just trying to... er scrape my HN account's favorites (AFAIK no API) becomes a task when you have to automate login. Just typing in and pressing the button is much easier than automating the task, so that's why the iframe is something useful. You can interact with the content (without code).
Re: I only use an iFrame to crawl and scrape content
#26do not understand why iframe is a must here, why can I just scrape the whole page directly? still learning web scraping using scrapy.
Normally if you click a link with jQuery, you lose the current context after the next page loads.
By controlling it inside an iframe it's more convenient
Re: I only use an iFrame to crawl and scrape content
#27Okay, the way I see this is that using headless tools like puppeteer or selenium is tedious; just trying to... er scrape my HN account's favorites (AFAIK no API) becomes a task when you have to automate login. Just typing in and pressing the button is much easier than automating the task, so that's why the iframe is something useful. You can interact with the content (without code).
Re: I only use an iFrame to crawl and scrape content
#28Yeesh, everyone is so critical here. It's just a blog post about how somebody does occasional one-off scraping across multiple pages using browser devtools. Yes of course injecting an iframe into a third-party site with devtools isn't going to replace Selenium. But it's a clever little hack in a pinch. No need to get upset.
Re: I only use an iFrame to crawl and scrape content
#29I can do everything listed in benefits with puppeteer, while I can’t even make sense of what iframe is supposed to achieve here, or how it’s even gonna load (anyone with a shred of sense would set X-Frame-Options to SAMEORIGIN, subject to exceptions). The airovic.com site doesn’t work and hilariously attempts to load two seemingly important scripts from localhost... I’m very confused about this submission, and even m…
I just submitted the article to recieve some feedback. I was working a lot on the tool and the article, but needed to check if I was into something.
I fixed the errors already. it is woking.