fix rule34 api url, guard against non-list responses

This commit is contained in:
Johannes
2026-05-06 03:12:55 +02:00
parent af38049294
commit 0e03681b5d

View File

@@ -55,7 +55,7 @@ SITES = {
'post_url_fmt': 'https://yande.re/post/show/{post_id}',
},
'rule34': {
'base_url': 'https://rule34.xxx/',
'base_url': 'https://api.rule34.xxx/',
'endpoint': 'index.php?page=dapi&s=post&q=index&json=1',
'per_page': 100,
'threads': 20,
@@ -83,6 +83,8 @@ def fetch_all_posts(adapter, query, auth, limit):
r.raise_for_status()
data = r.json()
batch = data[adapter['envelope']] if adapter['envelope'] else data
if not isinstance(batch, list):
raise RuntimeError(f'API returned unexpected response: {batch!r}')
if not batch:
break
posts.extend(batch)