Update README.md to include SerpApiSearch sample#26
Open
Conversation
Include the generic `SerpApiSearch` class instruction
tanys123
requested changes
Jun 6, 2025
Comment on lines
+112
to
+116
| parameter.put("engine", "google_lens"); // You can adjust the engine here | ||
| parameter.put("url", "https://i.imgur.com/HBrB8p0.png"); | ||
| parameter.put("api_key", serpApiKey); | ||
|
|
||
| SerpApiSearch search = new SerpApiSearch(parameter); // Use SerpApiSearch class |
There was a problem hiding this comment.
Base on the implementation, api_key and engine should pass as method parameter else exception is raised:
google-search-results-java/src/main/java/serpapi/SerpApiSearch.java
Lines 55 to 58 in aff4a9c
Suggested change
| parameter.put("engine", "google_lens"); // You can adjust the engine here | |
| parameter.put("url", "https://i.imgur.com/HBrB8p0.png"); | |
| parameter.put("api_key", serpApiKey); | |
| SerpApiSearch search = new SerpApiSearch(parameter); // Use SerpApiSearch class | |
| parameter.put("url", "https://i.imgur.com/HBrB8p0.png"); | |
| SerpApiSearch search = new SerpApiSearch(parameter, serpApiKey, "google_lens"); // Use SerpApiSearch class |
Author
|
Thank you @tanys123 for the feedback. I haven't been able to test it locally. Still struggling with installing this library. |
Yea, it is not a straightforward one, I guess we should take some time to clean up the repo. I was also banging here and there to get it to work. I am able to get it to work this way:
--- a/demo/build.gradle
+++ b/demo/build.gradle
dependencies {
- // implementation fileTree(dir: "./libs", includes: ['*.jar'])
+ // Use local JAR files from libs directory
+ implementation fileTree(dir: "./libs", includes: ['*.jar'])
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
- implementation 'com.github.serpapi:google-search-results-java:2.0.3'
}
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many customers are confused about how to use this library with other search engines outside Google Search. This PR includes the generic
SerpApiSearchclass instruction.For example: #23