When requesting a keyword (eg “Automobile”), the bot must return an image of the object being searched for. How to implement a search?

Is it possible to connect to search engines? Or is it still better to take some resource and parse it with the help of JSoup, the fact is that the search will be on a specific topic. But there is a second question, is it possible that the resource will not be parsed too fast, in order to take just one image?

I implement a bot in Java, is it possible to connect to a search engine?

  • I assume that you need to have a program that is on the server with a bot and do a search through it. Check out the source codes for similar bots in order to accurately do everything correctly (for example, Yandex has such a bot). - Rostislav Dugin
  • @RostislavDugin thanks - Abraham
  • telegram.me/pic -? - mymedia

1 answer 1

How to implement a search?

The most obvious and common solution is with the help of search engines. You can use, for example, Google Images , Yandex. Pictures , or some other, local resources.

Is it possible to connect to search engines?

Yes, it is possible. However, in the case of a high frequency of requests, you will need to somehow handle the situation with the introduction of captcha. Basic solution methods:

  • Use the service to manually recognize text from images like antigate.com and the like;

  • Use proxy (partial solution);

  • Ask the user to enter the code from the image;

Options are arranged in a random order, and not in order of priority. The final solution depends on the specific task.

Or is it better to take some resource?

In search engines, you can limit your search to specific domains, for example, on Google you can do this by:

site:stackoverflow.com график 

When searching for images for this query, you will get the found images for the keyword "graph" within the domain stackoverflow.com (and its subdomains).

It is worth noting that the relevance of search results in some cases may be low.

  • Wow, interesting information, thanks - Abraham