Legedith / Sirius_WhatsApp_Bot

A Harry Potter themed WhatsApp bot. Can be used to search music, videos or to spam someone.
10 stars 8 forks source link

Add Google Image search #20

Open Legedith opened 4 years ago

Legedith commented 4 years ago

Return the first image from google image search

gunjanraval commented 4 years ago

Do you want to return the actual image(.jpg) or the link? Because sending the image would mean downloading it and then attaching it to send. Do you have any other approach in mind?

Legedith commented 4 years ago

I want the image. I had this approach in mind:

  1. Get the URL of the image
  2. Open a new tab with that URL
  3. Send Ctrl + s key combination
  4. Send enter
  5. Go back to WhatsApp web tab
  6. Click on attachment icon, select image and upload it
  7. Press send button

The reason I want the actual image instead of just the URL is sometimes a person's phone's internet is terribly slow where as at their home, the system running WhatsApp web would have considerable speed. So all the data heavy task of searching the image would be handled by the pc since once we attach the image, WhatsApp will automatically reduce its size to mere kbs

gunjanraval commented 4 years ago

Ok! I am confused from the 6th point, how are we going to select the image, because the file systems would be different in different OS. I was thinking that Copying and Pasting(in the message box) the image also works on Whatsapp web. I'll try both

gunjanraval commented 4 years ago

Hey! I'm stuck at this part, I've downloaded the image to the CWD, but I am unable to send it. Do you have any ideas? I've tried copying and sending the image(didn't work), I'm trying to attach it and send the image but not able to figure out the "attach" button's id/class/css.

Edit: I got around the attach(clip icon) button and selecting the photo/video option, now the problem is selecting the image to upload it. As every OS has a different FileSystem how can we generalize it?

singleparadox commented 4 years ago

I think Beautiful Soup 4 would be best for this

gunjanraval commented 4 years ago

@singleparadox Can you elaborate on the approach?

singleparadox commented 4 years ago

Beautiful Soup 4 for mining the image/text data since it does not involve simulating user interaction. However, I am not sure what to do with that file system issue.

gunjanraval commented 4 years ago

Ok, but I already have found a way to get the image just the uploading part is remaining.