1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00

add tests for specific datetime values

This commit is contained in:
Mike Fährmann 2020-02-23 16:48:30 +01:00
parent 80ecb99089
commit 4e361b3008
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
18 changed files with 45 additions and 40 deletions

View File

@ -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",
},
},
}),

View File

@ -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,

View File

@ -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",

View File

@ -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",

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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",

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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"],

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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: