[GelbooruBridge] + inheriting Bridges. Switch to using Gelbooru API#2472
[GelbooruBridge] + inheriting Bridges. Switch to using Gelbooru API#2472dvikan merged 6 commits intoRSS-Bridge:masterfrom
Conversation
…into Rule34Bridge
|
Okay i tested GelbooruBridge and Rule and that was enough. |
| } | ||
|
|
||
| if (is_null($posts)) { | ||
| returnServerError('No posts found.'); |
There was a problem hiding this comment.
Do we want this? It generates HTTP 500 Internal Server Error from us. Maybe better to give user an empty feed?
There was a problem hiding this comment.
Due to how the API works, this should only ever occur when someone is testing/creating a new feed via the web interface. Once they have a working feed URL, it should never generate this error. It may generate the exact same result every single time it's queried, if it's an unpopular tag, but the results should never shrink/disappear. Unless somehow all items with the queried tag are subsequently deleted from the site. If the the site itself goes down or the API changes/stops working, that should fail at a different point in the code.
|
@quickwick I'm getting an empty string from the api here: https://mspabooru.com/index.php?&page=dapi&s=post&q=index&json=1&pid=1&limit=5&tags=pinup This url is produced by the example values in Gelbooru. I guess it's this kicking: |
Edit:
Instead of parsing HTML, use the available public Gelbooru API and get the data from the JSON response.
This modifies the GelbooruBridge, plus all the other Bridges for booru sites that run on Gelbooru: MspabooruBridge, Rule34Bridge, SafebooruBridge, TbibBridge, and XbooruBridge.
BooruprojectBridge had to be modified to inherit from DanbooruBridge instead of GelbooruBridge, since those sites are running an older version of Gelbooru which doesn't appear to include the API.
Benefits/changes: