[gelbooru] rewrite mp4 video URLs (fixes #1048)
This commit is contained in:
@@ -51,7 +51,7 @@ class BooruExtractor(SharedConfigMixin, Extractor):
|
|||||||
|
|
||||||
for image in images:
|
for image in images:
|
||||||
try:
|
try:
|
||||||
url = image["file_url"]
|
url = self.get_file_url(image)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
if url.startswith("/"):
|
if url.startswith("/"):
|
||||||
@@ -86,6 +86,10 @@ class BooruExtractor(SharedConfigMixin, Extractor):
|
|||||||
"""Collect metadata for extractor-job"""
|
"""Collect metadata for extractor-job"""
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_file_url(image):
|
||||||
|
return image["file_url"]
|
||||||
|
|
||||||
def extended_tags(self, image, page=None):
|
def extended_tags(self, image, page=None):
|
||||||
"""Retrieve extended tag information"""
|
"""Retrieve extended tag information"""
|
||||||
if not page:
|
if not page:
|
||||||
|
|||||||
@@ -33,6 +33,15 @@ class GelbooruExtractor(booru.XmlParserMixin,
|
|||||||
self.session.cookies["fringeBenefits"] = "yup"
|
self.session.cookies["fringeBenefits"] = "yup"
|
||||||
self.per_page = 42
|
self.per_page = 42
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_file_url(image):
|
||||||
|
url = image["file_url"]
|
||||||
|
if url.startswith("https://mp4.gelbooru.com/"):
|
||||||
|
ihash = image["md5"]
|
||||||
|
return "https://img2.gelbooru.com/images/{}/{}/{}.webm".format(
|
||||||
|
ihash[0:2], ihash[2:4], ihash)
|
||||||
|
return url
|
||||||
|
|
||||||
def items_noapi(self):
|
def items_noapi(self):
|
||||||
yield Message.Version, 1
|
yield Message.Version, 1
|
||||||
data = self.get_metadata()
|
data = self.get_metadata()
|
||||||
|
|||||||
Reference in New Issue
Block a user