Earlier quoted context omitted.
In general, if you're going the mechanize route, .retrieve() is the function your looking for. e.g. br = mechanize.Browser() br.retrieve("https://www.google.com/images/srpr/logo3w.png, google_logo.png)[0] Mechanize doesn't really have a proper doc, but just about everything you'd need could be figured out from the very lengthy examples page on their site.
Playing with it now, and while it seems to hit my download need, I can't seem to get it to play nice with sites that are JavaScript dependent. Am I missing something, or is there a way to plugin an underlying WebKit engine?
I Don’t Need No Stinking API: Web Scraping For Fun and Profit
101–110 of 176 posts
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#102 Since the third party service conducted rate-limiting based on IP
address (stated in their docs), my solution was to put the code that
hit their service into some client-side Javascript, and then send
the results back to my server from each of the clients.
This way, the requests would appear to come from thousands of
different places, since each client would presumably have their own
unique IP address, and none of them would individually be going over
the rate limit.
Pretty sure the browser Same Original Policy forbids this. Think about it- if this worked, you'd be able to scrape inside corporate firewalls simply by having users visit your website from behind the firewall.Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#103There is just one major trouble with not needing stinking API. You can not POST as a possible client without requiring them to give their password to you, which actually would give you full access to their account instead of limited access with API.
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#104Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#105Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#106Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#107Node.js is excellent for web scaping, especially if you're scraping large amounts very often.
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#108From the article: Since the third party service conducted rate-limiting based on IP address (stated in their docs), my solution was to put the code that hit their service into some client-side Javascript, and then send the results back to my server from each of the clients. This way, the requests would appear to come from thousands of different places, since each client would presumably have their own unique IP addre…
By the way, that's one of my projects. You can use a basic fibonacci-related algorithm to figure out (in the most minimal number of requests) what exactly the rate limit is. This way, you can scrape at just under the maximum limit. I am still working on this core library though. :|
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#109People seem to wonder how to handle ajax. The answer is HttpFox. It records all http-requests. 1. Start recording 2. Do some action that causes data to be fetched 3. Stop recording. You will find the url, the returned data, and a nice table of get and post-variables. https://addons.mozilla.org/en-us/firefox/addon/httpfox/
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#110Node.js is excellent for web scaping, especially if you're scraping large amounts very often.
I made this module for this exact reason: https://github.com/icodeforlove/node-requester . Supports horrible things like proxy rotation.
Do you have any plans to track which proxies are actually working, or how quickly each one is blocked? I want a reverse proxy on my outgoing requests that knows how to shift my traffic around properly so that I don't get banned. I don't want to be rate limited and I don't want to sit here for weeks trying to figure out wtf the rate limit is in the first place.