Last active
October 17, 2019 20:22
-
-
Save doroudi/d57bc6685c30236dfcc1322c27ff6e50 to your computer and use it in GitHub Desktop.
Get Movies Information
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class TopmoviesSpider(scrapy.Spider): | |
name = 'topMovies' | |
allowed_domains = ['imdb.com'] | |
start_urls = ['https://www.imdb.com/chart/top/'] | |
def parse(self, response): | |
movies = response.css(".lister-list tr") | |
for movie in movies: | |
yield { | |
'image': movie.css('.posterColumn img::attr(src)').extract_first(), | |
'title': movie.css('.titleColumn a::text').extract_first(), | |
'link': movie.css('.titleColumn a::text').extract_first(), | |
'rate': movie.css('.ratingColumn strong::text').extract_first() | |
} | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment