mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[tumblr] add 'day' extractor (#3951)
This commit is contained in:
parent
de670bd7de
commit
5297ee0cd9
@ -844,7 +844,7 @@ Consider all sites to be NSFW unless otherwise known.
|
||||
<tr>
|
||||
<td>Tumblr</td>
|
||||
<td>https://www.tumblr.com/</td>
|
||||
<td>Likes, Posts, Tag Searches, User Profiles</td>
|
||||
<td>Days, Likes, Posts, Tag Searches, User Profiles</td>
|
||||
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text, oauth, exception
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, date, timedelta
|
||||
import re
|
||||
|
||||
|
||||
@ -421,6 +421,35 @@ class TumblrTagExtractor(TumblrExtractor):
|
||||
return self.api.posts(self.blog, {"tag": self.tag})
|
||||
|
||||
|
||||
class TumblrDayExtractor(TumblrExtractor):
|
||||
"""Extractor for Tumblr user's posts by day"""
|
||||
subcategory = "day"
|
||||
pattern = BASE_PATTERN + r"/day/(\d\d\d\d/\d\d/\d\d)"
|
||||
test = (
|
||||
("https://mikf123.tumblr.com/day/2018/01/05", {
|
||||
"pattern": r"https://64\.media\.tumblr\.com"
|
||||
r"/1a2be8c63f1df58abd2622861696c72a"
|
||||
r"/tumblr_ozm9nqst9t1wgha4yo1_1280\.jpg",
|
||||
"keyword": {"id": 169341068404},
|
||||
"count": 1,
|
||||
}),
|
||||
("https://www.tumblr.com/blog/view/mikf123/day/2018/01/05"),
|
||||
("https://www.tumblr.com/blog/mikf123/day/2018/01/05"),
|
||||
("https://www.tumblr.com/mikf123/day/2018/01/05"),
|
||||
)
|
||||
|
||||
def __init__(self, match):
|
||||
TumblrExtractor.__init__(self, match)
|
||||
year, month, day = match.group(4).split("/")
|
||||
self.date_min = ts = (
|
||||
# 719163 == date(1970, 1, 1).toordinal()
|
||||
date(int(year), int(month), int(day)).toordinal() - 719163) * 86400
|
||||
self.api.before = ts + 86400
|
||||
|
||||
def posts(self):
|
||||
return self.api.posts(self.blog, {})
|
||||
|
||||
|
||||
class TumblrLikesExtractor(TumblrExtractor):
|
||||
"""Extractor for a Tumblr user's liked posts"""
|
||||
subcategory = "likes"
|
||||
|
@ -229,6 +229,9 @@ SUBCATEGORY_MAP = {
|
||||
"smugmug": {
|
||||
"path": "Images from Users and Folders",
|
||||
},
|
||||
"tumblr": {
|
||||
"day": "Days",
|
||||
},
|
||||
"twitter": {
|
||||
"media": "Media Timelines",
|
||||
"tweets": "",
|
||||
|
Loading…
Reference in New Issue
Block a user