File size: 484 Bytes
d907837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from abc import abstractmethod
from httpx import AsyncClient
from pydantic import BaseModel


class ScrapperBackendBase(BaseModel):
    """Base class for a source scrapper"""

    @property
    @abstractmethod
    def content_type(self) -> str:
        """Type of content that this backend can scrap. Used to determine what scrap backend to use to scrap full contents."""
        pass

    @abstractmethod
    async def scrap(self, client: AsyncClient, id: str) -> dict:
        pass