[aryion] provide correct 'date' independent of dst

This commit is contained in:
Mike Fährmann
2022-03-24 22:41:59 +01:00
parent 0744cad6d6
commit b03ca7f10c

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2020-2021 Mike Fährmann # Copyright 2020-2022 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -11,6 +11,8 @@
from .common import Extractor, Message from .common import Extractor, Message
from .. import text, util, exception from .. import text, util, exception
from ..cache import cache from ..cache import cache
from email.utils import parsedate_tz
from datetime import datetime
BASE_PATTERN = r"(?:https?://)?(?:www\.)?aryion\.com/g4" BASE_PATTERN = r"(?:https?://)?(?:www\.)?aryion\.com/g4"
@@ -144,7 +146,8 @@ class AryionExtractor(Extractor):
title, _, artist = text.unescape(extr( title, _, artist = text.unescape(extr(
"<title>g4 :: ", "<")).rpartition(" by ") "<title>g4 :: ", "<")).rpartition(" by ")
data = {
return {
"id" : text.parse_int(post_id), "id" : text.parse_int(post_id),
"url" : url, "url" : url,
"user" : self.user or artist, "user" : self.user or artist,
@@ -152,7 +155,7 @@ class AryionExtractor(Extractor):
"artist": artist, "artist": artist,
"path" : text.split_html(extr( "path" : text.split_html(extr(
"cookiecrumb'>", '</span'))[4:-1:2], "cookiecrumb'>", '</span'))[4:-1:2],
"date" : extr("class='pretty-date' title='", "'"), "date" : datetime(*parsedate_tz(lmod)[:6]),
"size" : text.parse_int(clen), "size" : text.parse_int(clen),
"views" : text.parse_int(extr("Views</b>:", "<").replace(",", "")), "views" : text.parse_int(extr("Views</b>:", "<").replace(",", "")),
"width" : text.parse_int(extr("Resolution</b>:", "x")), "width" : text.parse_int(extr("Resolution</b>:", "x")),
@@ -167,12 +170,6 @@ class AryionExtractor(Extractor):
"_mtime" : lmod, "_mtime" : lmod,
} }
d1, _, d2 = data["date"].partition(",")
data["date"] = text.parse_datetime(
d1[:-2] + d2, "%b %d %Y %I:%M %p", -5)
return data
class AryionGalleryExtractor(AryionExtractor): class AryionGalleryExtractor(AryionExtractor):
"""Extractor for a user's gallery on eka's portal""" """Extractor for a user's gallery on eka's portal"""
@@ -249,7 +246,7 @@ class AryionPostExtractor(AryionExtractor):
"title" : "I'm on subscribestar now too!", "title" : "I'm on subscribestar now too!",
"description": r"re:Doesn't hurt to have a backup, right\?", "description": r"re:Doesn't hurt to have a backup, right\?",
"tags" : ["Non-Vore", "subscribestar"], "tags" : ["Non-Vore", "subscribestar"],
"date" : "dt:2019-02-16 19:30:00", "date" : "dt:2019-02-16 19:30:34",
"path" : [], "path" : [],
"views" : int, "views" : int,
"favorites": int, "favorites": int,