Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving trouble understanding where to look in source code, in order to create a web scraper
    primarykey
    data
    text
    <p>I am noob with python, been on and off teaching myself since this summer. I am going through the scrapy tutorial, and occasionally reading more about html/xml to help me understand scrapy. My project to myself is to imitate the scrapy tutorial in order to scrape <a href="http://www.gamefaqs.com/boards/916373-pc" rel="nofollow">http://www.gamefaqs.com/boards/916373-pc</a>. I want to get a list of the thread title along with the thread url, should be simple!</p> <p>My problem lies in not understanding xpath, and also html i guess. When viewing the source code for the gamefaqs site, I am not sure what to look for in order to pull the link and title. I want to say just look at the anchor tag and grab the text, but i am confused on how. </p> <pre><code>from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from tutorial.items import DmozItem class DmozSpider(BaseSpider): name = "dmoz" allowed_domains = ["http://www.gamefaqs.com"] start_urls = ["http://www.gamefaqs.com/boards/916373-pc"] def parse(self, response): hxs = HtmlXPathSelector(response) sites = hxs.select('//a') items = [] for site in sites: item = DmozItem() item['link'] = site.select('a/@href').extract() item['desc'] = site.select('text()').extract() items.append(item) return items </code></pre> <p>I want to change this to work on gamefaqs, so what would i put in this path? I imagine the program returning results something like this thread name thread url I know the code is not really right but can someone help me rewrite this to obtain the results, it would help me understand the scraping process better.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload