Created
February 22, 2015 04:19
-
-
Save blizzarddreams/1fd88a15a1d59a824e24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scrapy.spider import Spider | |
| from scrapy.selector import Selector | |
| from pokemonscraper.items import PokemonItem | |
| class PkmnSpider(Spider): | |
| name = "pkmn" | |
| allowed_domains = ["http://bulbapedia.bulbagarden.net"] | |
| start_urls = [ | |
| "http://bulbapedia.bulbagarden.net/wiki/Keldeo_(Pokemon)", | |
| "http://bulbapedia.bulbagarden.net/wiki/Gengar_(Pokemon)", | |
| ] | |
| def parse(self, response): | |
| pkmn = PokemonItem() | |
| name = response.xpath('//*[@id="firstHeading"]/span').extract()[0] | |
| color = response.xpath('//*[@id="mw-content-text"]/table[3]/tbody/tr[11]/td[1]/table/tbody/tr/td').extract() | |
| pkmn['name'] = name | |
| pkmn['color'] = color | |
| yield pkmn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment