FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: fix SerpApi link and add migration guide from google-search-results-java by jvmvik · Pull Request #5 · serpapi/serpapi-java · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .erb  (1) .md  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
50 changes: 49 additions & 1 deletion README.md
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![serpapi-java](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml/badge.svg)](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml)
[![](https://jitpack.io/v/serpapi/serpapi-java.svg)](https://jitpack.io/#serpapi/serpapi-java)

Integrate search data into your Java application. This library is the official wrapper for SerpApi (https://serpapi.com).
Integrate search data into your Java application. This library is the official wrapper for [SerpApi](https://serpapi.com).

SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.

Expand Down Expand Up @@ -539,6 +539,54 @@ System.out.println(results.toString());
see: [https://serpapi.com/images-results](https://serpapi.com/images-results)


## Migration from google-search-results-java

If you are upgrading from the legacy [`google-search-results-java`](https://github.com/serpapi/google-search-results-java) library, here is a summary of what changed.

### Dependency

```gradle
// before
implementation 'com.github.serpapi:google-search-results-java:2.0.0'

// after
implementation 'com.github.serpapi:serpapi-java:1.1.0'
```

### Class and method renames

| Old (`google-search-results-java`) | New (`serpapi-java`) |
|------------------------------------|----------------------|
| `GoogleSearch` | `SerpApi` |
| `SerpApiSearch` | `SerpApi` |
| `client.getJson()` | `client.search(parameter)` |
| `client.getHtml()` | `client.html(parameter)` |
| `client.getSearchArchive(id)` | `client.searchArchive(id)` |
| `client.getAccount()` | `client.account()` |
| `client.getLocation(parameter)` | `client.location(parameter)` |
| `SerpApiSearchException` | `SerpApiException` |

### Example

```java
// before
Map<String, String> parameter = new HashMap<>();
parameter.put("q", "coffee");
parameter.put("api_key", "your_api_key");
GoogleSearch search = new GoogleSearch(parameter);
JsonObject results = search.getJson();

// after
Map<String, String> auth = new HashMap<>();
auth.put("api_key", "your_api_key");
SerpApi client = new SerpApi(auth);

Map<String, String> parameter = new HashMap<>();
parameter.put("q", "coffee");
parameter.put("engine", "google");
JsonObject results = client.search(parameter);
```

### Contributing

We use JUnit, **GitHub Actions** (see [workflow](https://github.com/serpapi/serpapi-java/blob/master/.github/workflows/gradle.yml)), and Gradle.
Expand Down
50 changes: 49 additions & 1 deletion README.md.erb
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end
[![serpapi-java](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml/badge.svg)](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml)
[![](https://jitpack.io/v/serpapi/serpapi-java.svg)](https://jitpack.io/#serpapi/serpapi-java)

Integrate search data into your Java application. This library is the official wrapper for SerpApi (https://serpapi.com).
Integrate search data into your Java application. This library is the official wrapper for [SerpApi](https://serpapi.com).

SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.

Expand Down Expand Up @@ -276,6 +276,54 @@ see: [https://serpapi.com/google-play-api](https://serpapi.com/google-play-api)
see: [https://serpapi.com/images-results](https://serpapi.com/images-results)


## Migration from google-search-results-java

If you are upgrading from the legacy [`google-search-results-java`](https://github.com/serpapi/google-search-results-java) library, here is a summary of what changed.

### Dependency

```gradle
// before
implementation 'com.github.serpapi:google-search-results-java:2.0.0'

// after
implementation 'com.github.serpapi:serpapi-java:1.1.0'
```

### Class and method renames

| Old (`google-search-results-java`) | New (`serpapi-java`) |
|------------------------------------|----------------------|
| `GoogleSearch` | `SerpApi` |
| `SerpApiSearch` | `SerpApi` |
| `client.getJson()` | `client.search(parameter)` |
| `client.getHtml()` | `client.html(parameter)` |
| `client.getSearchArchive(id)` | `client.searchArchive(id)` |
| `client.getAccount()` | `client.account()` |
| `client.getLocation(parameter)` | `client.location(parameter)` |
| `SerpApiSearchException` | `SerpApiException` |

### Example

```java
// before
Map<String, String> parameter = new HashMap<>();
parameter.put("q", "coffee");
parameter.put("api_key", "your_api_key");
GoogleSearch search = new GoogleSearch(parameter);
JsonObject results = search.getJson();

// after
Map<String, String> auth = new HashMap<>();
auth.put("api_key", "your_api_key");
SerpApi client = new SerpApi(auth);

Map<String, String> parameter = new HashMap<>();
parameter.put("q", "coffee");
parameter.put("engine", "google");
JsonObject results = client.search(parameter);
```

### Contributing

We use JUnit, **GitHub Actions** (see [workflow](https://github.com/serpapi/serpapi-java/blob/master/.github/workflows/gradle.yml)), and Gradle.
Expand Down
Loading

Back | FazBrowse Home | New Git URL