aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/philomena.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-03-01 19:51:45 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-03-01 19:51:45 -0500
commitbc1c79d35e0a75bc8da8f6f010df779c4acca201 (patch)
tree9d8808a5aec770221eb667160a3fbda61f9d5d49 /gallery_dl/extractor/philomena.py
parent75e3edb22dad2fc506494bb90ee6b331f5169adf (diff)
parent889c7b8caec8fc0b9c7a583ed1d9cfa43518fc42 (diff)
Update upstream source from tag 'upstream/1.29.0'
Update to upstream version '1.29.0' with Debian dir 7b309aa6ccc040a2faaf51d37a63f5233590a8d7
Diffstat (limited to 'gallery_dl/extractor/philomena.py')
-rw-r--r--gallery_dl/extractor/philomena.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/gallery_dl/extractor/philomena.py b/gallery_dl/extractor/philomena.py
index 1b67272..201d4d6 100644
--- a/gallery_dl/extractor/philomena.py
+++ b/gallery_dl/extractor/philomena.py
@@ -10,7 +10,6 @@
from .booru import BooruExtractor
from .. import text, exception
-import operator
class PhilomenaExtractor(BooruExtractor):
@@ -24,17 +23,22 @@ class PhilomenaExtractor(BooruExtractor):
def _init(self):
self.api = PhilomenaAPI(self)
- if not self.config("svg", True):
- self._file_url = operator.itemgetter("view_url")
+ self.svg = self.config("svg", True)
def _file_url(self, post):
- if post["format"] == "svg":
- return post["view_url"].rpartition(".")[0] + ".svg"
- return post["view_url"]
+ try:
+ url = post["representations"]["full"]
+ except Exception:
+ url = post["view_url"]
+
+ if self.svg and post["format"] == "svg":
+ return url.rpartition(".")[0] + ".svg"
+ return url
@staticmethod
def _prepare(post):
- post["date"] = text.parse_datetime(post["created_at"])
+ post["date"] = text.parse_datetime(
+ post["created_at"][:19], "%Y-%m-%dT%H:%M:%S")
BASE_PATTERN = PhilomenaExtractor.update({