Python Scraping Data From the Web A World Full of Spiders Crawling Spiders

Oszkár Fehér
Oszkár Fehér
Treehouse Project Reviewer

I got no data

I followed as the video

import scrapy


class HorseSpider(scrapy.Spider):
    name = 'ike'

    def start_requests(self):
        urls = ['https://treehouse-projects.github.io/horse-land/index.html',
                'https://treehouse-projects.github.io/horse-land/mustang.html'
                ]

        return [scrapy.Request(url=url, callback=self.parse) for url in urls]

    def parse(self, response):
        url = response.url
        page = url.split('/')[-1]
        filename = 'horses-%s' % page
        print('URL is: {}'.format(url))
        with open(filename, 'wb') as file:
            file.write(response.body)
        print('Saved file %s' % filename)

and i got this error:

ModuleNotFoundError: No module named 'win32api'

Can someone help me out with this please.

1 Answer

Try installing it with

pip install pypiwin32

Or

pip3 install pypiwin32
Oszkár Fehér
Oszkár Fehér
Treehouse Project Reviewer

It worked. Thanks a lot Alexander. I just wonder why this is not mentioned in the teachers notes?!

Not sure :/