Web Scraping 101 with Python
11–20 of 80 posts
Re: Web Scraping 101 with Python
#12PyQuery is pretty awesome ( https://pypi.python.org/pypi/pyquery ) Using Requests to download the document, pump it into PyQuery and you can use any jQuery style selectors to get text, attributes and all sorts of other stuff. Example; Here's how to scrape the hacker news homepage https://gist.github.com/samarudge/035ab8aaca224415cb49 (that code could probably be improved but I only spent a couple of minutes on it)
Re: Web Scraping 101 with Python
#13Learning Scrapy was made easier after some experience with BS.
Re: Web Scraping 101 with Python
#141. Python - BeautifulSoup
2. Ruby - Nokogiri (use in conjunction with Watir if you're scraping a very client-heavy website).
3. C# - HtmlAgilityPack in conjunction with ScrapySharp (there's a nuget package for both) - I highly recommend ScrapySharp because it allows you to query elements using a very familiar Css selector type similar to how you query dom elements in jQuery. :)
Scraping online content is so simple these days, if a website doesn't offer an API you still have alternatives ;)
Re: Web Scraping 101 with Python
#15This will only be a good approach if you are going to scrape a small amount of pages. The problem is using synchronous requests, as this blocks the crawler until a request has finished. Using asynchronous requests such as supported by twisted (and scrapy) will allow you to crawl a lot faster using the same resources.
Re: Web Scraping 101 with Python
#16Re: Web Scraping 101 with Python
#17Re: Web Scraping 101 with Python
#18Why is he using lxml as the parser and not just the one built into BS?
Re: Web Scraping 101 with Python
#19Re: Web Scraping 101 with Python
#20PyQuery is pretty awesome ( https://pypi.python.org/pypi/pyquery ) Using Requests to download the document, pump it into PyQuery and you can use any jQuery style selectors to get text, attributes and all sorts of other stuff. Example; Here's how to scrape the hacker news homepage https://gist.github.com/samarudge/035ab8aaca224415cb49 (that code could probably be improved but I only spent a couple of minutes on it)