News for hackers. Stuff that matters.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by jancurn on Tuesday July 09, 2024 @04:42AM (#40913796)
Hey all,

This is Jan, the founder of Apify (https://apify.com/) — a full-stack web scraping platform. After the success of Crawlee for JavaScript (https://github.com/apify/crawlee/) and the demand from the Python community, we're launching Crawlee for Python today!

The main features are:

- A unified programming interface for both HTTP (HTTPX with BeautifulSoup) & headless browser crawling (Playwright)

- Automatic parallel crawling based on available system resources

- Written in Python with type hints for enhanced developer experience

- Automatic retries on errors or when you’re getting blocked

- Integrated proxy rotation and session management

- Configurable request routing - direct URLs to the appropriate handlers

- Persistent queue for URLs to crawl

- Pluggable storage for both tabular data and files

For details, you can read the announcement blog post: https://crawlee.dev/blog/launching-crawlee-python

Our team and I will be happy to answer here any questions you might have.

Re:Show HN: Crawlee for Python – a web scraping and browser ... by c0brac0bra on Tuesday July 09, 2024 @08:12AM (#40915166)
Wanted to say thanks for apify/crawlee. I'm a long-time node.js user and your library has worked better than all the others I've tried.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by jancurn on Tuesday July 09, 2024 @11:43AM (#40917423)
Thank you!
Re:Show HN: Crawlee for Python – a web scraping and browser ... by marban on Tuesday July 09, 2024 @05:55AM (#40914219)
Nice list, but what would be the arguments for switching over from other libraries? I’ve built my own crawler over time, but from what I see, there’s nothing truly unique.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by jancurn on Tuesday July 09, 2024 @06:04AM (#40914278)
The main advantage (for now) is that the library has a single interface for both HTTP and headless browsers, and bundled auto scaling. You can write your crawlers using the same base abstraction, and the framework takes care of this heavy lifting. Developers of scrapers shouldn't need to reinvent the wheel, and just focus on building the "business" logic of their scrapers. Having said that, if you wrote your own crawling library, the motivation to use Crawlee might be lower, and that's fair enough.

Please note that this is the first release, and we'll keep adding many more features as we go, including anti-blocking, adaptive crawling, etc. To see where this might go, check https://github.com/apify/crawlee

Re:Show HN: Crawlee for Python – a web scraping and browser ... by robertlagrant on Tuesday July 09, 2024 @08:29AM (#40915309)
Can I ask - what is anti-blocking?
Re:Show HN: Crawlee for Python – a web scraping and browser ... by fullspectrumdev on Tuesday July 09, 2024 @08:32AM (#40915345)
Usually refers to “evading bot detection”.

Detecting when blocked and switching proxy/“browser fingerprint”.

Re:Show HN: Crawlee for Python – a web scraping and browser ... by robertlagrant on Tuesday July 09, 2024 @09:23AM (#40915828)
Is this a good feature to include? Shouldn't we respect the host's settings on this?
Re:Show HN: Crawlee for Python – a web scraping and browser ... by nlh on Tuesday July 09, 2024 @09:45AM (#40916077)
It’s a fair and totally reasonable question but clashes with reality. Many hosts have data that others want/like to scrape (eBay, Amazon, Google, airlines, etc.) and they setup anti-scraping mechanisms to try and prevent scraping. Whether or not to respect those desires is a bigger question but not one for the scraping library - it’s one for those doing the scraping and their lawyers.

The fact is - many many people want to scrape these sites and there is massive demand for tools to help them do that, so if APIFY/Crawlee decide to take the moral ground and not offer a way around bot detection, someone else will.

Re:Show HN: Crawlee for Python – a web scraping and browser ... by thebytefairy on Tuesday July 09, 2024 @10:40AM (#40916690)
Ah yes, the old 'if I don't build the bombs for them, someone else will'. I don't think this is taking the moral high ground, this is saying we don't care whether it's moral, there's demand and we'll build it.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by jancurn on Tuesday July 09, 2024 @11:18AM (#40917106)
There are many legitimate and legal use cases where one might want to circumvent blocking of bots. We believe that everyone has the moral right to access and fairly use non-personal publicly available data on the web the way they want, not just the way the publishers want them to. This is the core founding principle of the open web, which allowed the web to become what it is today.

BTW we continuously update this exhaustive post covering all legal aspects of web scraping: https://blog.apify.com/is-web-scraping-legal/

Re:Show HN: Crawlee for Python – a web scraping and browser ... by beeboobaa3 on Tuesday July 09, 2024 @12:53PM (#40918218)
Re:Show HN: Crawlee for Python – a web scraping and browser ... by mnmkng on Tuesday July 09, 2024 @01:45PM (#40918866)
It’s an “old” law that did not consider many intricacies of internet and the platforms that exist on it and it’s mostly made obsolete by EU case law, which has shrunk the definition of a protected database under this law so much that it’s practically inapplicable to web scraping.

(Not my opinion. I visited a major global law firm’s seminar on this topic a month ago and this is what they said.)

Re:Show HN: Crawlee for Python – a web scraping and browser ... by amarcheschi on Tuesday July 09, 2024 @11:00AM (#40916909)
I'm not gonna feel bad if a corporation gets its data scraped (whenever it's legal to do so, and this is another kind of question I'm not knowledgeable enough to face) when they themselves try to scrape other companies' data
Re:Show HN: Crawlee for Python – a web scraping and browser ... by robertlagrant on Tuesday July 09, 2024 @12:04PM (#40917683)
You seem to have a massive category error here. To my understanding, this is not only going to circumvent the scraping protection of companies that scrape other people's data.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by BiteCode_dev on Tuesday July 09, 2024 @12:24PM (#40917936)
Google and Amazon where built on scrapped data, who are you kidding?
Re:Show HN: Crawlee for Python – a web scraping and browser ... by robertlagrant on Tuesday July 09, 2024 @03:17PM (#40919810)
There's a bidirectional benefit to Google at least. That's why SEO exists. People want to appear in search results.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by nurettin on Tuesday July 09, 2024 @03:14PM (#40919760)
I make sure to enroll in projects which scrape Google/Amazon en-masse just for the satisfaction.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by Findecanor on Tuesday July 09, 2024 @11:47AM (#40917468)
Does it have support for web scraping opt-out protocols, such as Robots.txt, HTTP and content tags? These are getting more important now, especially in the EU after the DSM directive.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by jancurn on Tuesday July 09, 2024 @12:22PM (#40917919)
Not yet, but it’s on the roadmap
Re:Show HN: Crawlee for Python – a web scraping and browser ... by mdaniel on Tuesday July 09, 2024 @12:33PM (#40918032)
You'll want to prioritize documenting the existing features, since it's no good having a super awesome full stack web scraping platform if only you can use it. I ordinarily would default to a "read the source" response but your cutesy coding style makes that a non-starter

As a concrete example: command-f for "tier" on https://crawlee.dev/python/docs/guides/proxy-management and tell me how anyone could possibly know what `tiered_proxy_urls: list[list[str]] | None = None` should contain and why?

Re:Show HN: Crawlee for Python – a web scraping and browser ... by mnmkng on Tuesday July 09, 2024 @01:38PM (#40918791)
Sorry about the confusion. Some features, like the tiered proxies, are not documented properly. You’re absolutely right. Updates will come soon.

We wanted to have as many features in the initial release as possible, because we have a local Python community conference coming up tomorrow and we wanted to have the library ready for that.

More docs will come soon. I promise. And thanks for the shout.

Re:Show HN: Crawlee for Python – a web scraping and browser ... by bn-l on Tuesday July 09, 2024 @02:02PM (#40919056)
I literally had to go through the entire codebase the documentation is that lacking. It’s boring to document but imo it’s the lowest hanging fruit to get people moving down that crawlee -> appify funnel.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by NoThisIsMe on Thursday July 11, 2024 @01:34AM (#40933936)
> but your cutesy coding style makes that a non-starter

I don't think this is fair. The code looks pretty readable to me.

Re:Show HN: Crawlee for Python – a web scraping and browser ... by ttymck on Thursday July 11, 2024 @03:10AM (#40934333)
Can you link to some of the cutesy code? I've never heard this before.
Re:Show HN: Crawlee for Python – a web scraping and browser ... by fforflo on Tuesday July 09, 2024 @02:32PM (#40919331)
I'd suggest bringing more code snippets from the test cases to documentation as examples.

Nice work though.