4 ms·
If you only need to scrape one University's one course list page to populate one database, your best bet is probably copy-paste with some tidying up with your t
by DanielStraight 16y ago
If you only need to scrape one University's one course list page to populate one database, your best bet is probably copy-paste with some tidying up with your text editor of choice. If you need to do more, I would look into Hpricot or Nokogiri, both Ruby libraries for parsing HTML. Then just download the page content, pass it to your parser of choice, and go wild.
- pstinnett 16y agoSecond this. I wouldn't say I'm a RoR expert, but I've used both Hpricot and Nokogiri. I found Hpricot was a little easier to get going but Nokogiri ended up working out better for me. They work very in very similar fashions and are fairly straightforward.
- bdclimber14 16y agowell... it's a big University... the largest in the country actually, so there are thousands and thousands of classes. I think copying/pasting may be time prohibitive. Is it possible to setup a crawler that would iterate through what could be hundreds of pages, with the same HTML structure, and download/parse the page?
- DanielStraight 16y agoYes. Look up Hpricot or Nokogiri and review the documentation. It will be clear how to get started. Basically you just give it a page and ask it what you want. If you want to handle multiple pages, just iterate through them like you'd iterate through anything else.
- janj 16y agoYes, that is exactly what the crawler should do. I had no crawler experience a few months ago but wanted to do the same thing. I didn't know Ruby so I want the Java route. Now it's trivially easy, I just wrote a crawler last night to pull a bunch of info off hundreds of pages for my next app. First start with how you yourself would get at each page of data. If it all starts from a head page figure out how to get to each link, follow those links and repeat until you are at the data pages. Then point your crawler to the head page and code in the patterns. If the pages are not all linked from a head page but have a url pattern figure out how to pull down the info needed to fill in the url pieces, pull that info down then visit each page filling in the pattern with the data you now have. I can't give any Ruby guidance but if you have general questions on web scraping you can shoot me an email.
- bdclimber14 16y agoThis is awesome... time to dive into hpricot!