Skip to content
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

Merged
merged 6 commits into from
Mar 29, 2022

Conversation

quickwick
Copy link
Contributor

@quickwick quickwick commented Feb 25, 2022

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:

  • Defined 'Author' value: the user who created the post
  • Unique per-item datestamp: Shows the date/time value from each item from the site, instead of all fetched items having the date/time of the feed fetch event
  • Define the number of items to fetch: up to 1000, according to API doc

@quickwick quickwick changed the title [Rule34Bridge] Switch to using Rule34.xxx API [GelbooruBridge] + inheriting Bridges. Switch to using Gelbooru API Mar 1, 2022
@dvikan
Copy link
Contributor

dvikan commented Mar 29, 2022

Okay i tested GelbooruBridge and Rule and that was enough.

@dvikan dvikan merged commit 907d09f into RSS-Bridge:master Mar 29, 2022
@quickwick quickwick deleted the Rule34Bridge branch March 29, 2022 23:57
@@ -76,6 +76,10 @@ public function collectData(){
$posts = $posts->post;
}

if (is_null($posts)) {
returnServerError('No posts found.');
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@dvikan
Copy link
Contributor

dvikan commented Apr 11, 2022

@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:

		if (is_null($posts)) {
			returnServerError('No posts found.');
		}

@quickwick
Copy link
Contributor Author

@dvikan PR #2645 changes the exampleValue to 'solo', which should be valid for GelbooruBridge and all bridges currently extending it, including MspabooruBridge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants