[tumblr] add 'day' extractor (#3951)
This commit is contained in:
@@ -844,7 +844,7 @@ Consider all sites to be NSFW unless otherwise known.
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Tumblr</td>
|
<td>Tumblr</td>
|
||||||
<td>https://www.tumblr.com/</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>
|
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from .. import text, oauth, exception
|
from .. import text, oauth, exception
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, date, timedelta
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
@@ -421,6 +421,35 @@ class TumblrTagExtractor(TumblrExtractor):
|
|||||||
return self.api.posts(self.blog, {"tag": self.tag})
|
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):
|
class TumblrLikesExtractor(TumblrExtractor):
|
||||||
"""Extractor for a Tumblr user's liked posts"""
|
"""Extractor for a Tumblr user's liked posts"""
|
||||||
subcategory = "likes"
|
subcategory = "likes"
|
||||||
|
|||||||
@@ -229,6 +229,9 @@ SUBCATEGORY_MAP = {
|
|||||||
"smugmug": {
|
"smugmug": {
|
||||||
"path": "Images from Users and Folders",
|
"path": "Images from Users and Folders",
|
||||||
},
|
},
|
||||||
|
"tumblr": {
|
||||||
|
"day": "Days",
|
||||||
|
},
|
||||||
"twitter": {
|
"twitter": {
|
||||||
"media": "Media Timelines",
|
"media": "Media Timelines",
|
||||||
"tweets": "",
|
"tweets": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user