[scrolller] fix exception for albums with missing media (#7428)
fixes regression introduced in a44ea6b3d9
This commit is contained in:
@@ -56,7 +56,12 @@ class ScrolllerExtractor(Extractor):
|
|||||||
|
|
||||||
files = []
|
files = []
|
||||||
for num, media in enumerate(album, 1):
|
for num, media in enumerate(album, 1):
|
||||||
src = max(media["mediaSources"], key=self._sort_key)
|
sources = media.get("mediaSources")
|
||||||
|
if not sources:
|
||||||
|
self.log.warning("%s/%s: Missing media file",
|
||||||
|
post.get("id"), num)
|
||||||
|
continue
|
||||||
|
src = max(sources, key=self._sort_key)
|
||||||
src["num"] = num
|
src["num"] = num
|
||||||
files.append(src)
|
files.append(src)
|
||||||
return files
|
return files
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
__version__ = "1.29.5"
|
__version__ = "1.29.6-dev"
|
||||||
__variant__ = None
|
__variant__ = None
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ __tests__ = (
|
|||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://scrolller.com/long-comic-the-twelve-tasks-of-eve-12ch1ve8ko",
|
"#url" : "https://scrolller.com/long-comic-the-twelve-tasks-of-eve-12ch1ve8ko",
|
||||||
|
"#comment": "album post (#7339)",
|
||||||
"#class" : scrolller.ScrolllerPostExtractor,
|
"#class" : scrolller.ScrolllerPostExtractor,
|
||||||
"#pattern": r"https://static\.scrolller\.com/\w+/long-comic-the-twelve-tasks-of-eve-\d+-\w+\.png",
|
"#pattern": r"https://static\.scrolller\.com/\w+/long-comic-the-twelve-tasks-of-eve-\d+-\w+\.png",
|
||||||
"#count" : 177,
|
"#count" : 177,
|
||||||
@@ -81,6 +82,17 @@ __tests__ = (
|
|||||||
"num" : range(1, 177),
|
"num" : range(1, 177),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://scrolller.com/some-quick-news-tboi-rule-34-mod-czedll1bum",
|
||||||
|
"#comment": "album post with empty 'mediaSources' (#7428)",
|
||||||
|
"#class" : scrolller.ScrolllerPostExtractor,
|
||||||
|
"#urls" : "https://static.scrolller.com/gamma/some-quick-news-tboi-rule-34-mod-1-50uolks94u.png",
|
||||||
|
"#count" : 1,
|
||||||
|
|
||||||
|
"count": 1,
|
||||||
|
"num" : 1,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://scrolller.com/following",
|
"#url" : "https://scrolller.com/following",
|
||||||
"#class" : scrolller.ScrolllerFollowingExtractor,
|
"#class" : scrolller.ScrolllerFollowingExtractor,
|
||||||
|
|||||||
Reference in New Issue
Block a user