[gelbooru] improve video file detection (fixes #2188)

not all files from 'https://video-cdnN.gelbooru.com' are videos
This commit is contained in:
Mike Fährmann
2022-01-12 21:33:02 +01:00
parent 4acc31bd9f
commit cdc96e1217

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2021 Mike Fährmann
# Copyright 2014-2022 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 GelbooruBase():
@staticmethod
def _file_url(post):
url = post["file_url"]
if url.startswith(("https://mp4.gelbooru.com/", "https://video-cdn")):
if url.endswith((".webm", ".mp4")):
md5 = post["md5"]
path = "/images/{}/{}/{}.webm".format(md5[0:2], md5[2:4], md5)
post["_fallback"] = GelbooruBase._video_fallback(path)