Scrapy/XPath help
Grant Rettke
grettke at acm.org
Fri Dec 21 16:34:11 EST 2012
More information about the Python-list mailing list
Fri Dec 21 16:34:11 EST 2012
- Previous message (by thread): Scrapy/XPath help
- Next message (by thread): Scrapy/XPath help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You might have better luck if you share the python make, version, os, error message, and some unit tests demonstrating what you expect. On Fri, Dec 21, 2012 at 3:21 PM, Always Learning <cbrowning at ou.edu> wrote: > Hello all. I'm new to Python, but have been playing around with it for a few weeks now, following tutorials, etc. I've spun off on my own and am trying to do some basic web scraping. I've used Firebug/View XPath in Firefox for some help with the XPaths, however, I still am receiving errors when I try to run this script. If you could help, it would be greatly appreciated! > > from scrapy.spider import BaseSpider > from scrapy.selector import HtmlXPathSelector > from cbb_info.items import CbbInfoItem, Field > > class GameInfoSpider(BaseSpider): > name = "game_info" > allowed_domains = ["www.sbrforum.com"] > start_urls = [ > 'http://www.sbrforum.com/betting-odds/ncaa-basketball/', > ] > > def parse(self, response): > hxs = HtmlXPathSelector(response) > toplevels = hxs.select("//div[@class='eventLine-value']") > items = [] > for toplevels in toplevels: > item = CbbInfoItem() > item ["teams"] = toplevels.select("/span[@class='team-name'/text()").extract() > item ["lines"] = toplevels.select("/div[@rel='19']").extract() > item.append(item) > return items > -- > http://mail.python.org/mailman/listinfo/python-list -- Grant Rettke | ACM, AMA, COG, IEEE grettke at acm.org | http://www.wisdomandwonder.com/ Wisdom begins in wonder. ((λ (x) (x x)) (λ (x) (x x)))
- Previous message (by thread): Scrapy/XPath help
- Next message (by thread): Scrapy/XPath help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list