Compare commits

...

3 Commits

Author SHA1 Message Date
34ea401c00 Adding a first implementation of the parse function 2025-12-26 12:14:07 +01:00
6e7a1d3378 Updating the TvShowItem class
Adding more fields
2025-12-26 12:13:27 +01:00
9cc98a9944 Adding and configuring pyrefly 2025-12-26 12:12:29 +01:00
2 changed files with 24 additions and 2 deletions

View File

@ -5,3 +5,11 @@ requires-python = ">=3.14"
dependencies = [ dependencies = [
"scrapy>=2.13.4", "scrapy>=2.13.4",
] ]
[tool]
[tool.pyrefly]
project-includes = [
"**/*.py*",
"**/*.ipynb",
]

View File

@ -10,8 +10,13 @@ from scrapy.linkextractors import LinkExtractor
class TvShowItem(scrapy.Item): class TvShowItem(scrapy.Item):
article_id = scrapy.Field()
article_title = scrapy.Field()
title = scrapy.Field() title = scrapy.Field()
release_date = scrapy.Field() date = scrapy.Field()
summary = scrapy.Field()
image_url = scrapy.Field()
download_url = scrapy.Field()
class TvShow(CrawlSpider): class TvShow(CrawlSpider):
@ -28,7 +33,16 @@ class TvShow(CrawlSpider):
] ]
def parse(self, response): def parse(self, response):
pass for article in response.css("article"):
item = TvShowItem()
item['article_id'] = article.attrib['id'],
item['article_title'] = article.css('h1.entry-title > a::text').get(),
item['title'] = article.css('.entry-summary > p > strong::text').get(),
item['date'] = article.css('.entry-meta-header-before::text').getall()[1].strip(),
item['summary'] = article.xpath('.//div[@class="entry-summary"]/node()').extract(),
item['image_url'] = article.css('.entry-summary > p > img::attr(src)').get(),
item['download_url'] = article.css('.entry-summary > p > a[href ^= "https://rapidgator"]::attr(href)').get()
yield item
def main(): def main():