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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions examples/Contacts And Leads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Contacts And Leads Scraper With Java

Allows finding email addresses, social links, phones, and other contacts from domains and URLs via the [Contacts & Leads API](https://app.outscraper.com/api-docs#tag/Email-Related/paths/~1contacts-and-leads/get).

## Installation

Java 11 or later

### Gradle

Edit your build.gradle file
``` sh
repositories {
maven { url "https://jitpack.io" }
}

dependencies {
implementation 'com.github.outscraper:outscraper-java:v2.1.0'
}
```

### Maven

Add the JitPack repository to your build file
``` sh
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
```

Add the dependency
``` sh
<dependency>
<groupId>com.github.outscraper</groupId>
<artifactId>outscraper-java</artifactId>
<version>v2.1.0</version>
</dependency>
```

### Others

You'll need to manually install the following JARs:
- [The Outscraper JAR](https://jitpack.io/com/github/outscraper/outscraper-java/v2.1.0/outscraper-java-v2.1.0.jar)
- [Json](https://repo1.maven.org/maven2/org/json/json/20090211/json-20090211.jar)
- [Httpcomponents](https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar)
- [Guava](https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar)

## Initialization
```java
OutscraperClient client = new OutscraperClient("SECRET_API_KEY");
```
[Link to the profile page to create the API key](https://app.outscraper.com/profile)

## Usage

```java
# Search contacts and leads from a website:
JSONArray results = client.contactsAndLeads(new HashMap<String, Object>() {{
put("query", "outscraper.com");
}});
System.out.println(results);
```
8 changes: 8 additions & 0 deletions src/main/java/OutscraperClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public JSONArray googlePlayReviews(HashMap<String, Object> parameters) {
return getData(response);
}

public JSONArray contactsAndLeads(HashMap<String, Object> parameters) {
parameters.put("async", false);

JSONObject response = getAPIRequest("/contacts-and-leads", parameters);

return getData(response);
}

public JSONArray emailsAndContacts(HashMap<String, Object> parameters) {
parameters.put("async", false);

Expand Down