-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GelbooruBridge] + inheriting Bridges. Switch to using Gelbooru API #2472
Conversation
Okay i tested GelbooruBridge and Rule and that was enough. |
@@ -76,6 +76,10 @@ public function collectData(){ | |||
$posts = $posts->post; | |||
} | |||
|
|||
if (is_null($posts)) { | |||
returnServerError('No posts found.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: