Earlier quoted context omitted.
Reddit JSON api (just add .json to any URL) is not good enough for you ?
Another proof that spending 15 minutes on research can save you days in development and production.
I Don’t Need No Stinking API: Web Scraping For Fun and Profit
81–90 of 176 posts
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#82The 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.
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#83Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#84Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#85I've done a ton of scraping (mostly legal: on behalf of end users of an app on sites they have legit access to). This article misses something that affects several sites: JavaScript driven content. Faking headers and even setting cookies doesn't get around this. This is of course is easy to get around, using something like phantom.js or Selenium. Selenium is great because unlike all the whiz bang scraping techniques,…
Depending on your use case, headless may be simpler, but it has also many drawbacks that don't show at first, the main being that they're not simple to drive from remote processes as queue-consuming devices.
The article suggests BeautifulSoup as a parsing library for python. If I'm not mistaken BeautifulSoup is not actively maintained anymore, and other cleaner and faster solutions exists, like lxml.html. Ian Bicking made a good article on that topic : http://blog.ianbicking.org/2008/03/30/python-html-parser-per...
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#86People 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
#87Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#88I love HTML scraping. But Javascript???...The juiciest data sets these days are increasingly in JS. For the love of me i can't get around scraping JS :( I do know that Selenium can be used for this...but am yet to see a decent example for the same. Does anyone have any good resources/examples on JS scraping that they could share?? I would be eternally grateful.
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#89An important topic. The main caveat is that this may violate a site's terms of use and thus website owners may feel called upon to sue you. Depending on circumstances, the legal situation here can be a long story.
My take on it, from ScraperWiki's point of view: http://blog.scraperwiki.com/2012/04/02/is-scraping-legal/
Re: I Don’t Need No Stinking API: Web Scraping For Fun and Profit
#90I love HTML scraping. But Javascript???...The juiciest data sets these days are increasingly in JS. For the love of me i can't get around scraping JS :( I do know that Selenium can be used for this...but am yet to see a decent example for the same. Does anyone have any good resources/examples on JS scraping that they could share?? I would be eternally grateful.
Phantom.js and casper.js If you can't get the data from the endpoints the javascript hits then write your scraper in javascript and have it run in a headless browser, and it's the webkit engine so most sites test their site against it heavily. Either pull the data out of the javascript objects or trigger your extraction from the html by attaching to the events in the javascript.