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

Include URL type in file metadata API response #235

Closed
floogulinc opened this issue Jun 13, 2020 · 3 comments
Closed

Include URL type in file metadata API response #235

floogulinc opened this issue Jun 13, 2020 · 3 comments
Labels
dev-notified HyDev has been notified of this feature-request system:api API related issues

Comments

@floogulinc
Copy link
Collaborator

Currently the known URLs section of an /get_files/file_metadata API response looks like this:

"known_urls" : [
				"https://gelbooru.com/index.php?page=post&s=view&id=4841557",
				"https://img2.gelbooru.com//images/80/c8/80c8646b4a49395fb36c805f316c49a9.jpg",
				"http://origin-orig.deviantart.net/ed31/f/2019/210/7/8/beachqueen_samus_by_dandonfuga-ddcu1xg.jpg"
			],

It would be nice if it could also include the URL type from the parser, eg "twitter tweet" and "booru post"

It could look like this, perhaps with different key names:

"known_urls" : [
				{
				  "url_name": "gelbooru post page",
				  "url": "https://gelbooru.com/index.php?page=post&s=view&id=4841557"
				},
			],

The "url type" may also be included as in /add_urls/get_url_info.

@floogulinc
Copy link
Collaborator Author

Original from Discord:
image

@CuddleBear92 CuddleBear92 added the system:api API related issues label Jun 13, 2020
@imtbl imtbl added the dev-notified HyDev has been notified of this label Jun 21, 2020
@hydrusnetwork
Copy link
Owner

Thank you. For tomorrow's release, I have added a parameter to /get_files/file_metadata, 'detailed_url_information' true/false, which will add 'detailed_known_urls' to the file metadata row with a list of the same info you get from /add_urls/get_url_info. The help is updated with an example. The Client API version is now 13.

Note that the type of an url is not cached and has to be computed on the fly by consulting the current url class structure, so I believe this could add significant lag when asking about hundreds or thousands of files at once, a bit like when you right-click in the client on a huge ctrl+a file selection.

I thought about suggesting just using /add_urls/get_url_info to look up URLs as needed, but this would be annoying and inefficient to do n times for every file.

Let me know how this works for you!

@floogulinc
Copy link
Collaborator Author

Hmm that's interesting. I didn't realize it would be inefficient like that. What would you think about allowing the get_url_info endpoint to take an array of URLs like many of the others do. Then I could just query all the URLs for a file on demand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-notified HyDev has been notified of this feature-request system:api API related issues
Projects
None yet
Development

No branches or pull requests

4 participants