-
Notifications
You must be signed in to change notification settings - Fork 27
Update README.md to include SerpApiSearch sample #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Include the generic `SerpApiSearch` class instruction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hilmanski 👍
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
public SerpApiSearch(Map<String, String> parameter, String api_key, String engine) { | |
this.parameter = parameter; | |
this.api_key = api_key; | |
this.engine = engine; |
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 |
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'
}
|
Many customers are confused about how to use this library with other search engines outside Google Search. This PR includes the generic
SerpApiSearch
class instruction.For example: #23