1
0
Fork 0
mirror of synced 2024-06-25 09:30:36 +12:00
bulk-downloader-for-reddit/bulkredditdownloader/site_downloaders/base_downloader.py

25 lines
729 B
Python
Raw Normal View History

2021-02-07 14:33:19 +13:00
#!/usr/bin/env python3
# coding=utf-8
import logging
from abc import ABC, abstractmethod
2021-02-25 23:40:08 +13:00
from typing import Optional
2021-02-07 14:33:19 +13:00
2021-02-11 12:10:40 +13:00
from praw.models import Submission
2021-02-26 21:57:05 +13:00
from bulkredditdownloader.site_authenticator import SiteAuthenticator
2021-02-11 12:10:40 +13:00
from bulkredditdownloader.resource import Resource
logger = logging.getLogger(__name__)
2021-02-07 14:33:19 +13:00
class BaseDownloader(ABC):
2021-02-25 23:40:08 +13:00
def __init__(self, post: Submission, typical_extension: Optional[str] = None):
2021-02-07 14:33:19 +13:00
self.post = post
2021-02-25 23:40:08 +13:00
self.typical_extension = typical_extension
2021-02-07 14:33:19 +13:00
@abstractmethod
2021-02-26 21:57:05 +13:00
def find_resources(self, authenticator: Optional[SiteAuthenticator] = None) -> list[Resource]:
2021-02-25 23:40:08 +13:00
"""Return list of all un-downloaded Resources from submission"""
raise NotImplementedError