build your own web scrapper
Build Your Own WebScraper- Dale Ma@eguitarz12年12月8日星期六
View Slide
@eguitarzIt’s fun to do something small andeasy.12年12月8日星期六
@eguitarzI always want to build a robot toserve me.12年12月8日星期六
@eguitarzSince making a robot is too difficult,so I choose to make a web bot.12年12月8日星期六
@eguitarzToday I’m talking about how do Ibuild my own web scraper in ruby.12年12月8日星期六
@eguitarzWeb scrapers have many uses. Forexample...12年12月8日星期六
@eguitarzUp time survey, image collecting,automate web snapshots and more...12年12月8日星期六
@eguitarzUsually, there are many scrapers(threads) fired at the same time.12年12月8日星期六
@eguitarzSo, first things first, I have to controlthe threads.12年12月8日星期六
@eguitarzI decide to write #threadpool to dothis such thing.12年12月8日星期六
@eguitarzYou can find that at https://github.com/eguitarz/threadpool12年12月8日星期六
@eguitarzThreadpool decides the life of eachthread.12年12月8日星期六
@eguitarzNow, let’s go for the main dish.12年12月8日星期六
@eguitarzWeb scrappers should be able to`grab page` and `parse html tags`.12年12月8日星期六
@eguitarz#Nokogiri is good at those things.12年12月8日星期六
@eguitarzI use “Hash” to save parsed links.12年12月8日星期六
@eguitarzThere’s a problem, links stored inhash by threads. But hash in ruby isnot thread-safe...12年12月8日星期六
@eguitarz#hamster helps me with this.12年12月8日星期六
@eguitarzI use `Depth-Limited Search`algorithm for my scrapper.3 21112年12月8日星期六
@eguitarzWhat if the page needs javascript torender?12年12月8日星期六
@eguitarzThere’s a easy way... use browser torender the html with javascript.12年12月8日星期六
@eguitarzHow?12年12月8日星期六
@eguitarz#Waltir or #Selenium12年12月8日星期六
Gonna show my little toy...12年12月8日星期六
@eguitarzMy scraper is on github at https://github.com/eguitarz/macaron12年12月8日星期六
@eguitarzThe demo is simple, `you` canenhance or create new one.12年12月8日星期六
@eguitarzWikipedia scraper, Facebookscraper... could be interesting!12年12月8日星期六
THANKS!12年12月8日星期六