[realbooru] extract video fallbacks (#8661)

This commit is contained in:
Mike Fährmann
2025-12-09 11:51:33 +01:00
parent efad90696d
commit 4ee998df0a
2 changed files with 4 additions and 1 deletions

View File

@@ -30,7 +30,8 @@ class RealbooruExtractor(booru.BooruExtractor):
post = {
"id" : post_id,
"rating" : "e" if rating == "adult" else (rating or "?")[0],
"file_url" : extr('src="', '"'),
"file_url" : (s := extr('src="', '"')),
"_fallback" : (extr('src="', '"'),) if s.endswith(".mp4") else (),
"created_at": extr(">Posted at ", " by "),
"uploader" : extr(">", "<"),
"score" : extr('">', "<"),

View File

@@ -76,6 +76,7 @@ __tests__ = (
"date" : "dt:2023-02-19 00:00:00",
"extension" : "gif",
"file_url" : "https://realbooru.com//images/a3/9b/a39bfe5ea07f132db486e118b598c66c.gif",
"_fallback" : (),
"filename" : "a39bfe5ea07f132db486e118b598c66c",
"id" : "825911",
"md5" : "a39bfe5ea07f132db486e118b598c66c",
@@ -101,6 +102,7 @@ __tests__ = (
"date" : "dt:2020-12-07 00:00:00",
"extension" : "mp4",
"file_url" : "https://video-cdn.realbooru.com//images/3c/34/3c343385126c90a7fdbccc58d342a511.mp4",
"_fallback" : ("https://video-cdn.realbooru.com//images/3c/34/3c343385126c90a7fdbccc58d342a511.webm",),
"filename" : "3c343385126c90a7fdbccc58d342a511",
"id" : "751237",
"md5" : "3c343385126c90a7fdbccc58d342a511",