mirror of
https://github.com/benbusby/whoogle-search.git
synced 2026-04-25 12:15:50 +03:00
[GH-ISSUE #3] "View Image" functionality. #3
Labels
No labels
Fixed (Pending PR Merge)
Stale
bug
enhancement
enhancement
good first issue
help wanted
keep-open
needs more info
pull-request
question
theme
unfortunate
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/whoogle-search#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cole8888 on GitHub (May 10, 2020).
Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/3
It would be pretty cool if we could incorporate the functionality from https://github.com/bijij/ViewImage which would give you the download link to a full sized image without having to visit the source website.
@benbusby commented on GitHub (May 15, 2020):
Just want to note that the framework for this feature is already started, if anyone wanted to jump in ahead of me and look into it some more. Part of the
Filterclass has a commented out section with a TODO, seen here:where
FULL_RES_IMGis just a stringified html linebreak and link tag, with formatting in place for the full res link:If the code to fetch the full size image url is fairly straight forward, all that would need to be done is replace
img_srcin the formatting section with the full size image url. Though that could be easier said than done, still haven't had a good chance to look through the ViewImage extension to see how that all works.@jacr13 commented on GitHub (May 26, 2020):
I have take a look at this feature and it seems that google load the true image url using javascript.
Since pycurl doesn't support javascript the true urls are impossible to get as it is...
@Aikatsui commented on GitHub (Oct 8, 2020):
@benbusby you have mentioned about google's images results implementation then i dont consider to open seperate issue.
Currently default images view page isn't soo good so i prefer if you can enhance it bit.
@federicotorrielli commented on GitHub (Apr 2, 2021):
Hey @benbusby I would like to work on this feature, where should I start?
@jacr13 commented on GitHub (Apr 2, 2021):
You should start to find a way to extract the real URL of an image (not the embedded version of google); if you have these URLs, the following is trivial.
As I said before, the problem is that these URLs are loaded with javascript...
@benbusby commented on GitHub (Apr 2, 2021):
@federicotorrielli what @jacr13 said is correct, although javascript solutions like the ViewImage repo linked in this issue don't work anymore (for me, at least).
One possible alternative to look into is somehow matching the desktop URL with the mobile URL, and using the mobile one for viewing the image at full resolution. Google's results seem to return the actual full size image link on mobile, but only a link to the source of the image on desktop. It might be a little hacky, but I think it would work.
An alternative to that alternative would be to just force the desktop image search to always return mobile results. The downsides of that would be that selecting the image would only ever return the (presumably full size) image itself and not the image source, and the layout of the mobile image search on desktop would look pretty bad without some additional styling.
Either way I think the bulk of the work would have to be in
filter.pysince that's where all of the HTML parsing occurs.@federicotorrielli commented on GitHub (Apr 2, 2021):
So, I tried to play a little bit with the code only to discover that this remains a huge problem. So, here's my two cents.
I will try to look into what I think is the best alternative, Google image search api. If all the request of the images are done to the API and not to the default search, it might be a cool way to get those faster.
@federicotorrielli commented on GitHub (Apr 3, 2021):
So, bad news. Google search image query api is limited to 100 queries per day, and it's not exactly what we want right now, so I'll try with the JS solution. Right now I need to:
@jacr13 commented on GitHub (Apr 3, 2021):
I think you are missing something; the view image script works on google because it looks for url when the page is loaded in the browser. With whoogle the page is loaded without javascript so the urls are not present so even if you inject the script from view image it will not work I think... does the add-on work with the parameter gbv=1 in the query ?
@federicotorrielli commented on GitHub (Apr 3, 2021):
@jacr13 Yes it does work (if I modify it). I'll try to study if I can somehow inject the js in the page I get from Google after the request.
EDIT: Actually, I forgot that Google gbv=1 does not come with any JS in it, so this is not possible, my mistake.
So the last thing we can try is the mobile one? Damn.
@jacr13 commented on GitHub (Apr 3, 2021):
Yes... for me the only way is to check if we are searching for images if it's the case request with mobile user agent get the resulting page and parse it to extract the url of the images. Than have a template html and add to it the images urls. Each image as no information about the web site (title etc) so each time we click on an image a collapse menu shloud appear and inside we should display the result of the request on google images with the real url of the image (without mobile user agent) this way we get metadata for the image (assuming the first image is the correct one) and some other images related. With this approche we can have the real image url and the url of the webpage where the image is.
@jacr13 commented on GitHub (Apr 6, 2021):
Here is a solution that works: #268.
The thumbnails are a bit blurry but this is due to the fact that mobile thumbnails are very small.
@benbusby commented on GitHub (Apr 16, 2021):
Merged in #268 and available on the
developbranch orbeta/buildx-experimentalimages once the build finishes. Thanks again @jacr13!