12

I'd like to build a webapp to help other students at my university create their schedules. To do that I need to crawl the master schedules (one huge html page) as well as a link to a detailed description for each course into a database, preferably in python. Also, I need to log in to access the data.

  • How would that work?
  • What tools/libraries can/should I use?
  • Are there good tutorials on that?
  • How do I best deal with binary data (e.g. pretty pdf)?
  • Are there already good solutions for that?
McEnroe
  • 633
  • 3
  • 7
  • 17

4 Answers4

12

If you want to use a powerful scraping framework there's Scrapy. It has some good documentation too. It may be a little overkill depending on your task though.

Community
  • 1
  • 1
Acorn
  • 49,061
  • 27
  • 133
  • 172
  • Would you recommend the same for this: http://stackoverflow.com/questions/23917790/how-to-web-crawl-some-sites – Si8 May 28 '14 at 17:46
4

Scrapy is probably the best Python library for crawling. It can maintain state for authenticated sessions.

Dealing with binary data should be handled separately. For each file type, you'll have to handle it differently according to your own logic. For almost any kind of format, you'll probably be able to find a library. For instance take a look at PyPDF for handling PDFs. For excel files you can try xlrd.

franklin
  • 1,800
  • 7
  • 32
  • 59
sharjeel
  • 5,825
  • 7
  • 34
  • 49
3

I liked using BeatifulSoup for extracting html data

It's as easy as this:

from BeautifulSoup import BeautifulSoup 
import urllib

ur = urllib.urlopen("http://pragprog.com/podcasts/feed.rss")
soup = BeautifulSoup(ur.read())
items = soup.findAll('item')

urls = [item.enclosure['url'] for item in items]
Alexey Grigorev
  • 2,415
  • 28
  • 47
  • I am using this too. I need to crawl about 1000 links on the same site ... but it takes too long... would you suggest me some better approach? I can show the code too –  Nov 07 '14 at 15:04
0

For this purpose there is a very useful tool called web-harvest Link to their website http://web-harvest.sourceforge.net/ I use this to crawl webpages

Riz
  • 368
  • 4
  • 18