Skip to content

victor141516/google-image-search-telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Image search Telegram inline bot

This bot is just like @bing but using Google Images as backend

Install instructions

First you need some Google search keys

  1. Go to https://console.developers.google.com and make a new project.

  2. Go to Library, enable Custom Search API and make a new credential using the button you will be prompted

  3. Copy your API key [CSE_KEY]

  4. From the Google Custom Search homepage ( http://www.google.com/cse/ ), click Create a Custom Search Engine.

  5. Type a name and description for your search engine.

  6. Under Define your search engine, in the Sites to Search box, enter at least one valid URL (For now, just put www.anyurl.com to get past this screen. More on this later ).

  7. Select the CSE edition you want and accept the Terms of Service, then click Next. Select the layout option you want, and then click Next.

  8. Click any of the links under the Next steps section to navigate to your Control panel.

  9. In the left-hand menu, under Control Panel, click Basics.

  10. In the Search Preferences section, select Search the entire web but emphasize included sites.

  11. Click Save Changes.

  12. In the left-hand menu, under Control Panel, click Sites.

  13. Delete the site you entered during the initial setup process.

  14. Copy your Search engine ID using the button for this purpose [CSE_CX].

Then your Telegram Bot API key

  1. Talk to @botfather using your Telegram account and he will give you your fresh new API key. [API_TOKEN]
  2. Copy your bot nickname [BOT_NAME].
  3. This is that easy

Deploy environment

I deploy my Telegram bots using Heroku, so this part will be based on this service but you can use any other if you know how to deploy a webapp using Flask

  1. Make a new Heroku app and copy its URL [WEBHOOK_URL]
  2. Copy the config_example.py file to config.py and place there all the vars you copied from previous steps: [BOT_NAME, CSE_KEY, CSE_CX, API_TOKEN, BATCH, WEBHOOK_URL]
  3. Add this file to the repo: git add config.py
  4. You will have to add all the Heroku related files: app.json, Procfile, Procfile.windows
  5. Add them: git add app.json Procfile Procfile.windows
  6. Commit and push it: git commit -am "This is a push" && git push heroku master
  7. Done!

Notes

When you deploy on Heroku you must change POLLING=True to POLLING=False in config.py. POLLING=True is meant for development. You can change BATCH=10 in config.py. This number means how much images the bot will send when someone ask for images and each time that someone pulls the image grid (on the Telegram app)

About

Inline Telegram Bot that search images using Google Images

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published