From 4e361b3008a9b3e8099225bf9fbdcedfa255010e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 23 Feb 2020 16:48:30 +0100 Subject: [PATCH] add tests for specific datetime values --- gallery_dl/extractor/8muses.py | 4 ++-- gallery_dl/extractor/bcy.py | 2 +- gallery_dl/extractor/blogger.py | 6 +++--- gallery_dl/extractor/furaffinity.py | 2 +- gallery_dl/extractor/hentaifoundry.py | 2 +- gallery_dl/extractor/imgur.py | 8 ++++---- gallery_dl/extractor/instagram.py | 11 ++++++----- gallery_dl/extractor/issuu.py | 2 +- gallery_dl/extractor/luscious.py | 4 ++-- gallery_dl/extractor/newgrounds.py | 8 ++++---- gallery_dl/extractor/nozomi.py | 4 ++-- gallery_dl/extractor/pururin.py | 6 +++--- gallery_dl/extractor/sexcom.py | 4 ++-- gallery_dl/extractor/tsumino.py | 4 ++-- gallery_dl/extractor/vsco.py | 4 ++-- gallery_dl/extractor/wallhaven.py | 6 +++--- gallery_dl/extractor/xhamster.py | 4 ++-- test/test_results.py | 4 ++++ 18 files changed, 45 insertions(+), 40 deletions(-) diff --git a/gallery_dl/extractor/8muses.py b/gallery_dl/extractor/8muses.py index 089a0e99..dec59729 100644 --- a/gallery_dl/extractor/8muses.py +++ b/gallery_dl/extractor/8muses.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -40,7 +40,7 @@ class _8musesAlbumExtractor(Extractor): "parent" : 10454, "views" : int, "likes" : int, - "date" : "type:datetime", + "date" : "dt:2018-07-10 00:00:00", }, }, }), diff --git a/gallery_dl/extractor/bcy.py b/gallery_dl/extractor/bcy.py index 32ad75ed..634ff186 100644 --- a/gallery_dl/extractor/bcy.py +++ b/gallery_dl/extractor/bcy.py @@ -111,7 +111,7 @@ class BcyPostExtractor(BcyExtractor): "post": { "id" : 6355835481002893070, "tags" : list, - "date" : "type:datetime", + "date" : "dt:2016-11-22 08:47:46", "parody" : "东方PROJECT", "content": "re:根据微博的建议稍微做了点修改", "likes" : int, diff --git a/gallery_dl/extractor/blogger.py b/gallery_dl/extractor/blogger.py index b95e59d0..2657b5d1 100644 --- a/gallery_dl/extractor/blogger.py +++ b/gallery_dl/extractor/blogger.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -99,7 +99,7 @@ class BloggerPostExtractor(BloggerExtractor): "pattern": r"https://3.bp.blogspot.com/.*/s0/Icy-Moonrise-.*.jpg", "keyword": { "blog": { - "date" : "type:datetime", + "date" : "dt:2010-11-21 18:19:42", "description": "", "id" : "5623928067739466034", "kind" : "blogger#blog", @@ -114,7 +114,7 @@ class BloggerPostExtractor(BloggerExtractor): "post": { "author" : "Julian Bunker", "content" : str, - "date" : "type:datetime", + "date" : "dt:2010-12-26 01:08:00", "etag" : str, "id" : "6955139236418998998", "kind" : "blogger#post", diff --git a/gallery_dl/extractor/furaffinity.py b/gallery_dl/extractor/furaffinity.py index 6781adb1..78cf9fc4 100644 --- a/gallery_dl/extractor/furaffinity.py +++ b/gallery_dl/extractor/furaffinity.py @@ -153,7 +153,7 @@ class FuraffinityPostExtractor(FuraffinityExtractor): "url": "eae4ef93d99365c69b31a37561bd800c03d336ad", "keyword": { "artist" : "mirlinthloth", - "date" : "type:datetime", + "date" : "dt:2016-11-27 17:24:06", "description": "A Song made playing the game Cosmic DJ.", "extension" : "mp3", "filename" : r"re:\d+\.\w+_dj_fennmink_-_bude_s_4_ever", diff --git a/gallery_dl/extractor/hentaifoundry.py b/gallery_dl/extractor/hentaifoundry.py index 19f9481c..6e820910 100644 --- a/gallery_dl/extractor/hentaifoundry.py +++ b/gallery_dl/extractor/hentaifoundry.py @@ -247,7 +247,7 @@ class HentaifoundryImageExtractor(HentaifoundryExtractor): "content": "91bf01497c39254b6dfb234a18e8f01629c77fd1", "keyword": { "artist" : "Tenpura", - "date" : "type:datetime", + "date" : "dt:2016-02-22 14:41:19", "description": "Thank you!", "height" : 700, "index" : 407501, diff --git a/gallery_dl/extractor/imgur.py b/gallery_dl/extractor/imgur.py index 5084e802..0813ea96 100644 --- a/gallery_dl/extractor/imgur.py +++ b/gallery_dl/extractor/imgur.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# Copyright 2015-2019 Mike Fährmann +# Copyright 2015-2020 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. -"""Extract images from https://imgur.com/""" +"""Extractors for https://imgur.com/""" from .common import Extractor, Message from .. import text, exception @@ -65,7 +65,7 @@ class ImgurImageExtractor(ImgurExtractor): "account_url" : None, "animated" : False, "bandwidth" : int, - "date" : "type:datetime", + "date" : "dt:2016-11-10 14:24:35", "datetime" : 1478787875, "description" : None, "edited" : "0", @@ -142,7 +142,7 @@ class ImgurAlbumExtractor(ImgurExtractor): "cover_edited": None, "cover_height": 1400, "cover_width" : 951, - "date" : "type:datetime", + "date" : "dt:2015-10-09 10:37:50", "datetime" : 1444387070, "description" : None, "favorite" : False, diff --git a/gallery_dl/extractor/instagram.py b/gallery_dl/extractor/instagram.py index 05adac1e..bf2e1bd7 100644 --- a/gallery_dl/extractor/instagram.py +++ b/gallery_dl/extractor/instagram.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2019 Leonardo Taccari, Mike Fährmann +# Copyright 2018-2019 Leonardo Taccari +# Copyright 2018-2020 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. -"""Extract images from https://www.instagram.com/""" +"""Extractors for https://www.instagram.com/""" from .common import Extractor, Message from .. import text, exception @@ -306,7 +307,7 @@ class InstagramImageExtractor(InstagramExtractor): r"/v(p/[0-9a-f]+/[0-9A-F]+)?/t51.2885-15/e35" r"/44877605_725955034447492_3123079845831750529_n.jpg", "keyword": { - "date": "type:datetime", + "date": "dt:2018-11-29 01:04:04", "description": str, "height": int, "likes": int, @@ -333,7 +334,7 @@ class InstagramImageExtractor(InstagramExtractor): ("https://www.instagram.com/p/Bqxp0VSBgJg/", { "pattern": r"/47129943_191645575115739_8539303288426725376_n\.mp4", "keyword": { - "date": "type:datetime", + "date": "dt:2018-11-29 19:23:58", "description": str, "height": int, "likes": int, @@ -349,7 +350,7 @@ class InstagramImageExtractor(InstagramExtractor): ("https://www.instagram.com/tv/BkQjCfsBIzi/", { "pattern": r"/10000000_1760663964018792_716207142595461120_n\.mp4", "keyword": { - "date": "type:datetime", + "date": "dt:2018-06-20 19:51:32", "description": str, "height": int, "likes": int, diff --git a/gallery_dl/extractor/issuu.py b/gallery_dl/extractor/issuu.py index 49d68ef8..b34b288b 100644 --- a/gallery_dl/extractor/issuu.py +++ b/gallery_dl/extractor/issuu.py @@ -35,7 +35,7 @@ class IssuuPublicationExtractor(IssuuBase, GalleryExtractor): "access" : "public", "articleStories": list, "contentRating" : dict, - "date" : "type:datetime", + "date" : "dt:2019-09-16 00:00:00", "description" : "re:Motions, the brand new publication by I", "documentId" : r"re:\d+-d99ec95935f15091b040cb8060f05510", "documentName" : "motions-1-2019", diff --git a/gallery_dl/extractor/luscious.py b/gallery_dl/extractor/luscious.py index c80cf14e..c31de1c0 100644 --- a/gallery_dl/extractor/luscious.py +++ b/gallery_dl/extractor/luscious.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016-2019 Mike Fährmann +# Copyright 2016-2020 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 @@ -59,7 +59,7 @@ class LusciousAlbumExtractor(LusciousExtractor): "cover" : "re:https://\\w+.luscious.net/.+/277031/", "created" : 1479625853, "created_by" : "NTRshouldbeillegal", - "date" : "type:datetime", + "date" : "dt:2016-11-20 07:10:53", "description" : "Enjoy.", "download_url": "/download/824778/277031/", "genres" : list, diff --git a/gallery_dl/extractor/newgrounds.py b/gallery_dl/extractor/newgrounds.py index 54e60b0d..c2072d67 100644 --- a/gallery_dl/extractor/newgrounds.py +++ b/gallery_dl/extractor/newgrounds.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2019 Mike Fährmann +# Copyright 2018-2020 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 @@ -194,7 +194,7 @@ class NewgroundsImageExtractor(NewgroundsExtractor): "keyword": { "artist" : ["tomfulp"], "comment" : "re:Consider this the bottom threshold for ", - "date" : "type:datetime", + "date" : "dt:2009-06-04 14:44:05", "description": "re:Consider this the bottom threshold for ", "favorites" : int, "filename" : "94_tomfulp_ryu-is-hawt", @@ -241,7 +241,7 @@ class NewgroundsMediaExtractor(NewgroundsExtractor): "keyword": { "artist" : ["psychogoldfish", "tomfulp"], "comment" : "re:People have been asking me how I like the ", - "date" : "type:datetime", + "date" : "dt:2012-02-08 21:40:56", "description": "re:People have been asking how I like the ", "favorites" : int, "filename" : "527818_alternate_1896", @@ -259,7 +259,7 @@ class NewgroundsMediaExtractor(NewgroundsExtractor): "keyword": { "artist" : ["zj", "tomfulp"], "comment" : "re:RECORDED 12-09-2014\n\nFrom The ZJ \"Late ", - "date" : "type:datetime", + "date" : "dt:2015-02-23 19:31:59", "description": "From The ZJ Report Show!", "favorites" : int, "index" : 609768, diff --git a/gallery_dl/extractor/nozomi.py b/gallery_dl/extractor/nozomi.py index 97be7896..dfe31e38 100644 --- a/gallery_dl/extractor/nozomi.py +++ b/gallery_dl/extractor/nozomi.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -86,7 +86,7 @@ class NozomiPostExtractor(NozomiExtractor): "character": ["patchouli knowledge"], "copyright": ["touhou"], "dataid" : "re:aaa9f7c632cde1e1a5baaff3fb6a6d857ec73df7fdc5cf5a", - "date" : "type:datetime", + "date" : "dt:2016-07-26 02:32:03", "extension": "jpg", "favorites": int, "filename" : str, diff --git a/gallery_dl/extractor/pururin.py b/gallery_dl/extractor/pururin.py index aa5c9c69..721fc2f1 100644 --- a/gallery_dl/extractor/pururin.py +++ b/gallery_dl/extractor/pururin.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -21,8 +21,8 @@ class PururinGalleryExtractor(GalleryExtractor): ("https://pururin.io/gallery/38661/iowant-2", { "pattern": r"https://cdn.pururin.io/\w+/images/data/\d+/\d+\.jpg", "keyword": { - "title" : "Iowant 2!!", - "title_en" : "Iowant 2!!", + "title" : "re:I ?owant 2!!", + "title_en" : "re:I ?owant 2!!", "title_jp" : "", "gallery_id": 38661, "count" : 19, diff --git a/gallery_dl/extractor/sexcom.py b/gallery_dl/extractor/sexcom.py index cbf2c188..521b0349 100644 --- a/gallery_dl/extractor/sexcom.py +++ b/gallery_dl/extractor/sexcom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -106,7 +106,7 @@ class SexcomPinExtractor(SexcomExtractor): "content": "e579e3283fea812d0545a3f79734b79bc3c51acb", "keyword": { "comments" : int, - "date" : "type:datetime", + "date" : "dt:2018-10-02 21:18:17", "extension": "jpg", "filename" : "20037816", "likes" : int, diff --git a/gallery_dl/extractor/tsumino.py b/gallery_dl/extractor/tsumino.py index 298b7e08..31dbdadb 100644 --- a/gallery_dl/extractor/tsumino.py +++ b/gallery_dl/extractor/tsumino.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -52,7 +52,7 @@ class TsuminoGalleryExtractor(TsuminoBase, GalleryExtractor): "title_en" : r"re:Shikoshiko Daisuki Nightingale \+ Kaijou", "title_jp" : "シコシコ大好きナイチンゲール + 会場限定おまけ本", "gallery_id": 40996, - "date" : "type:datetime", + "date" : "dt:2018-06-29 00:00:00", "count" : 42, "collection": "", "artist" : ["Itou Life"], diff --git a/gallery_dl/extractor/vsco.py b/gallery_dl/extractor/vsco.py index 0781adf6..a0200644 100644 --- a/gallery_dl/extractor/vsco.py +++ b/gallery_dl/extractor/vsco.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -192,7 +192,7 @@ class VscoImageExtractor(VscoExtractor): "grid" : "erenyildiz", "meta" : dict, "tags" : list, - "date" : "type:datetime", + "date" : "dt:2019-07-21 19:12:11", "video" : False, "width" : 1537, "height": 1537, diff --git a/gallery_dl/extractor/wallhaven.py b/gallery_dl/extractor/wallhaven.py index 737c2533..043da0b5 100644 --- a/gallery_dl/extractor/wallhaven.py +++ b/gallery_dl/extractor/wallhaven.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2019 Mike Fährmann +# Copyright 2018-2020 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. -"""Extract images from https://wallhaven.cc/""" +"""Extractors for https://wallhaven.cc/""" from .common import Extractor, Message from .. import text @@ -77,7 +77,7 @@ class WallhavenImageExtractor(WallhavenExtractor): "group" : "Owner/Developer", "username" : "AksumkA", }, - "date" : "type:datetime", + "date" : "dt:2014-08-31 06:17:19", "wh_category": "anime", "views" : int, "favorites" : int, diff --git a/gallery_dl/extractor/xhamster.py b/gallery_dl/extractor/xhamster.py index 62acb288..04225892 100644 --- a/gallery_dl/extractor/xhamster.py +++ b/gallery_dl/extractor/xhamster.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2020 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 @@ -49,7 +49,7 @@ class XhamsterGalleryExtractor(XhamsterExtractor): "pageURL": str, "thumbURL": str, "gallery": { - "date": "type:datetime", + "date": "dt:2019-04-16 00:07:31", "description": "", "dislikes": int, "id": 11748968, diff --git a/test/test_results.py b/test/test_results.py index 44a68b6e..fbf65663 100644 --- a/test/test_results.py +++ b/test/test_results.py @@ -12,6 +12,7 @@ import sys import re import json import hashlib +import datetime import unittest from gallery_dl import extractor, util, job, config, exception @@ -154,6 +155,9 @@ class TestExtractorResults(unittest.TestCase): elif isinstance(test, str): if test.startswith("re:"): self.assertRegex(value, test[3:], msg=key) + elif test.startswith("dt:"): + self.assertIsInstance(value, datetime.datetime, msg=key) + self.assertEqual(str(value), test[3:], msg=key) elif test.startswith("type:"): self.assertEqual(type(value).__name__, test[5:], msg=key) else: