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

Add new api for wikipedia image info #29

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

zexigong
Copy link

@zexigong zexigong commented Mar 5, 2023

No description provided.

@zexigong
Copy link
Author

zexigong commented Mar 5, 2023

@tuukka
Copy link
Contributor

tuukka commented Mar 22, 2023

Thank you for this pull request! I wanted to investigate this more myself but I haven't had the time. Perhaps you can answer some of the questions I have:

  1. What if anything does the function getWikidataImagesFromWikipedia have to do with Wikidata?
  2. Is there a reason to get the information one image at a time, or would it be better to get all images with one request? Example
  3. Is there a reason to return the raw imageinfo response, or would it be better to convert the response to the format that the Wikidocumentaries image viewer uses?
  4. Would it make sense to share code with wikimedia-commons.js, which does similar things?

@zexigong
Copy link
Author

  1. It is a typo. Will fix that in the new commit.
  2. I decided to get the information one image at a time for two reasons:
  • I have tried to get all images with one request. The image metadata returned is not always ordered. There will be extra works to make the metadata ordered.
  • Wikipedia get the information one image at a time.
    There is no significant latency difference between two approaches. I could try to get the information together if you think it is a better approach.
  1. Yes I will convert the response to the format image viewer uses at backend. Previously I did that work at frontend.
  2. It is hard to share the entire code here. The urls and required params are different. The converting logic can be shared. I will create a util function in my next commit.
    Thanks for your insight!

Migrated parsing logic to backend,
shared code with wikimedia-commons
added more fields
fixed typo
@zexigong
Copy link
Author

Hi @tuukka, in the new commit

  • Fixed wikidata typo
  • Converted the response to the format that the Wikidocumentaries image viewer uses at the backend
  • Shared the code with wikimedia-commons.js by creating a new util function to process the data
  • Added more imageviewer fields in the new util function

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.

2 participants