spark-c / SparksieBOT

A Discord bot that provides upkeep, utility, and some fun commands for my personal discord server.
1 stars 0 forks source link

!cat command returns small image thumbnail #3

Open spark-c opened 3 years ago

spark-c commented 3 years ago

Current behavior: !cat returns a link to a thumbnail image from Google search results. This image is small and cannot be seen in a larger form.

Desired behavior: !cat should return a larger image, so that it can be clicked in discord and seen at a reasonable size.

Further info: This seems to be common behavior when trying to scrape images from search engines; I've tried adapting this command to use a different engine, but a couple others also present this issue of returning a thumbnail.

Next Step: While writing this, I popped by ecosia.org image search to check on what it looked like. I don't remember what the obstacle was last time, but it looks like it may be possible to scrape appropriately large images from here?

Here is an example of what an img result looks like (target with class="image-result__image"):

<img src="https://tse4.mm.bing.net/th?id=OIP.RGO2_JeImrSM658MPIASrwHaEo&amp;pid=Api" data-src="https://tse4.mm.bing.net/th?id=OIP.RGO2_JeImrSM658MPIASrwHaEo&amp;pid=Api" alt="kittens, Kitten, Cat, Cats, Baby, Cute Wallpapers HD ..." class="image-result__image" data-v-737b338e="">

That src link is directly to the target image and can be accessed by pasting it into the browser.

Testing required.