wayback fix

This commit is contained in:
msramalho
2022-05-10 23:15:58 +02:00
parent bca960b228
commit d7f44b948f
2 changed files with 4 additions and 7 deletions

View File

@@ -5,18 +5,15 @@ from bs4 import BeautifulSoup
from storages import Storage
from .base_archiver import Archiver, ArchiveResult
# @dataclass
# class WaybackConfig:
# key: str
# secret: str
from configs import WaybackConfig
# TODO: use WaybackConfig
class WaybackArchiver(Archiver):
name = "wayback"
def __init__(self, storage: Storage, driver):
def __init__(self, storage: Storage, driver, config: WaybackConfig):
super(WaybackArchiver, self).__init__(storage, driver)
self.config = config
self.seen_urls = {}
def download(self, url, check_if_exists=False):
@@ -25,7 +22,7 @@ class WaybackArchiver(Archiver):
ia_headers = {
"Accept": "application/json",
"Authorization": "LOW " + os.getenv('INTERNET_ARCHIVE_S3_KEY') + ":" + os.getenv('INTERNET_ARCHIVE_S3_SECRET')
"Authorization": f"LOW {self.config.key}:{self.config.secret}"
}
r = requests.post(

View File

@@ -95,7 +95,7 @@ def process_sheet(c: Config, sheet, header=1, columns=GWorksheet.COLUMN_NAMES):
TiktokArchiver(storage, c.webdriver),
YoutubeDLArchiver(storage, c.webdriver, c.facebook_cookie),
TwitterArchiver(storage, c.webdriver),
WaybackArchiver(storage, c.webdriver)
WaybackArchiver(storage, c.webdriver, c.wayback_config)
]
for archiver in active_archivers: