-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix wikidata info box images #878
Conversation
If it is OK for you I will put some improvements (commit) on top of your branch. |
Ok but let me rebase my commit. If I don't do this my commit is not signed and it will show an "Unverified" sign on GitHub. |
True / inform me when you are ready .. |
No I mean if you want to squash everything in one commit let me do it, so that the commit is signed. |
ah, sorry .. I will push WIP commit on top you can squash or even drop .. |
Wikidata info box images are now loaded from uploads.wikimedia.org instead of commons.wikimedia.org to prevent redirects Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
@tiekoetter I added a WIP commit on top which polish the implementation a little bit and adds a some debug messages.
With this debug messages I noticed, that the calculated redirect URL is not a thumb, it is the full image. In the example above I searched for The origin URL from wikidata (which is redirected) is the thumb (59kB): and the redirected URL we calculate is the full size image (10,3MB): https://upload.wikimedia.org/wikipedia/commons/0/0d/Peterborough_Cathedral_March_2010.jpg Now I have a doubt that caluclate the redirect URL is a the right solution. May be it is better when the image_proxy follows the redirects. |
677e62d
to
560a14e
Compare
@return42 We can specify the max size of an image. |
You surprise me a second time, your investigative skill is really good :-) Do you have time to implement? .. Otherwise tomorrow I can give it a try. |
@return42 I am almost done. Just waiting for |
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
@tiekoetter your solutions works perfect except for such cases where are more than one image, since the images with lower prio are selected. I tried
does not exists, but the second image with the higher prio, the portrait exists: I pushed a commit on top that selects the image with higher prio .. what do you think about? |
@return42 I read on this problem on stackoverflow. They said that if the image is an .svg you need to add .png to get the correct I will add the fix when the test is done. |
@return42 Search |
Add '.png' to the second img_src_name if it has the extension '.svg'. Use urllib.parse.unquote for URL decoding.
ee30df4
to
1c151ae
Compare
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
@tiekoetter: seems it is fixed by your last patch .. do you see any issues more / I made some tests and for me it works now without any issue. I added a commit on top with some pylint hints, no functional change. If you do not see any issues more, I would like to merge this PR. |
Which commits should be squashed and what should be the commit message(s)? |
From my side there is no more need to squash, as far I can see, each commit has a commit message that fits to the patch .. but it is up to you, if you want to squash feel free to do so. |
No if you think it is ok than there is indeed no need. I also think this PR is ready. |
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.
Works like a charm :-)
@tiekoetter: I really enjoyed in the collaboration we had, I am very much looking forward to your next contribution :-) .. thanks!
Openstreatmap images are now loaded from uploads.wikimedia.org instead of commons.wikimedia.org to prevent redirects. With `image_proxy` enabled images from commons.wikimedia.org cant be loaded since they are redirected. We already discussed this issue [875] and @tiekoetter fixed this issue in PR [878]. Related-to: - [875] searxng#875 - [878] searxng#878 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
What does this PR do?
This PR fixes the wikidata info box images when the image proxy is enabled.
Why is this change important?
Without the fix info box images from wikidata are not loaded correctly.
How to test this PR locally?
make run
!wd test
Related issues
Closes #875