1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[tumblr] add 'hash' keyword

'hash' is the middle part of the filename in a tumblr image URL.
For example an image with '.../tumblr_p6tgemp1NZ1wgha4yo1_250.png' as
its URL would have 'p6tgemp1NZ1wgha4yo1' as hash.
This commit is contained in:
Mike Fährmann 2018-04-07 15:28:55 +02:00
parent ffc0c67701
commit 6b72be8ee6
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,7 @@
# Changelog
## Unreleased
## 1.3.3 - 2018-04-06
- Added extractors for
- `nhentai` search results

View File

@ -103,11 +103,11 @@ class KissmangaChapterExtractor(KissmangaBase, ChapterExtractor):
r"/Manga/[^/?&#]+/[^/?&#]+\?id=(\d+)"]
test = [
("http://kissmanga.com/Manga/Dropout/Ch-000---Oneshot-?id=145847", {
"url": "4136bcd1c6cecbca8cc2bc965d54f33ef0a97cc0",
"url": "46e63fd63e9e16f19bc1e6c7a45dc060815642fd",
"keyword": "4a3a9341d453541de0dbfa24cd6b2e3ed39c0182",
}),
("http://kissmanga.com/Manga/Urban-Tales/a?id=256717", {
"url": "de074848f6c1245204bb9214c12bcc3ecfd65019",
"url": "c26be8bf9c2abacee2076979d021634092cf38f1",
"keyword": "ffc11b630da44fe67709ed0473756cf51b90a05c",
}),
("http://kissmanga.com/Manga/Monster/Monster-79?id=7608", {

View File

@ -146,14 +146,20 @@ class TumblrExtractor(Extractor):
@staticmethod
def _prepare(url, post):
text.nameext_from_url(url, post)
post["offset"] += 1
return Message.Url, url, text.nameext_from_url(url, post)
post["hash"] = post["name"].partition("_")[2]
return Message.Url, url, post
@staticmethod
def _prepare_image(url, post):
text.nameext_from_url(url, post)
post["offset"] += 1
urls = _original_image(url)
return Message.Urllist, urls, text.nameext_from_url(url, post)
parts = post["name"].split("_")
post["hash"] = parts[1] if parts[1] != "inline" else parts[2]
return Message.Urllist, _original_image(url), post
class TumblrUserExtractor(TumblrExtractor):

View File

@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "1.3.3"
__version__ = "1.3.4-dev"