Spaces:
Runtime error
Runtime error
File size: 551 Bytes
21e639d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from .base import Parser
from .....configs import COOKIES
from typing import Callable, List
from dataclasses import dataclass
from scrapy import Request, Selector
@dataclass
class IndexParser(Parser):
"""
The IndexParser object parses one of the index.html files.
"""
title_tags: List[Selector]
def parse(self, callback: Callable):
tag_lists = list(self.title_tags.items())
for title_tag in tag_lists:
url = title_tag.attr("href")
yield Request(url, cookies=COOKIES, callback=callback)
|