# -*- coding: utf-8 -*-
# Copyright 2024-2026 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extractors for https://saint2.su/ and https://turbovid.cr/"""
from .lolisafe import LolisafeAlbumExtractor
from .. import text
BASE_PATTERN = r"(?:https?://)?(?:turbovid\.cr|saint\d*\.(?:su|pk|cr|to))"
class SaintAlbumExtractor(LolisafeAlbumExtractor):
"""Extractor for saint albums"""
category = "saint"
root = "https://saint2.su"
pattern = BASE_PATTERN + r"/a/([^/?#]+)"
example = "https://saint2.su/a/ID"
def fetch_album(self, album_id):
# album metadata
response = self.request(self.root + "/a/" + album_id)
extr = text.extract_from(response.text)
title = extr("
", "')
files = []
while True:
id2 = extr("/thumbs/", '"')
if not id2:
break
id2, sep, ts = id2.rpartition(".")[0].rpartition("-")
if sep:
date = self.parse_timestamp(ts)
else:
date = None
id2 = ts
files.append({
"id" : extr("/embed/", '"'),
"id2" : id2,
"date" : date,
# "extension": extr("