The job
Resellers and analysts want the market price. Resolve a place to coordinates, search a keyword there, and read each listing.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/facebook/marketplace/location/search | Facebook Marketplace location search | 1 credit |
GET /v1/facebook/marketplace/search | Facebook Marketplace search | 1 credit |
GET /v1/facebook/marketplace/item | Facebook Marketplace listing | 1 credit |
Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.
Recipe
- Resolve a city name to latitude and longitude.
- Search listings around it.
- Open an item for the details.
Preview
The API is in early access. Calls use
api.socialscrape.io and return the shapes in the reference.Python
import os
import requests
API = "https://api.socialscrape.io"
HEADERS = {"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]}
def get(path, **params):
res = requests.get(API + path, headers=HEADERS, params=params, timeout=60)
res.raise_for_status()
return res.json()["data"]
# Facebook Marketplace location search
places = get("/v1/facebook/marketplace/location/search", query="Austin")
print(places["items"][:3])TypeScript
const API = "https://api.socialscrape.io";
const headers = { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! };
async function get(path: string, params: Record<string, string | number | boolean>) {
const query = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)]));
const res = await fetch(`${API}${path}?${query}`, { headers });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
return (await res.json()).data;
}
// Facebook Marketplace location search
const places = await get("/v1/facebook/marketplace/location/search", { query: "Austin" });
console.log(places.items.slice(0, 3));Good to know
A marketplace search needs a place, either a location or latitude and longitude, so resolve the city first. The search endpoint page lists the filters.