2.3 KiB
2.3 KiB
Marketplace Cookies Setup
Both Facebook Marketplace and eBay require valid session cookies to bypass bot detection and access listings.
Cookie Priority Hierarchy
All scrapers follow this priority order (highest to lowest):
- URL Parameter - Passed directly in API/MCP request (overrides all)
- Environment Variable - Set as
FACEBOOK_COOKIEorEBAY_COOKIE - Cookie File - Stored in
facebook.jsonorebay.json(fallback)
Facebook Marketplace (facebook.json)
Required Cookies
c_user: Your Facebook user IDxs: Facebook session tokenfr: Facebook request tokendatr: Data attribution tokensb: Session browser token
Setup Methods
Method 1: Cookie File (Lowest Priority)
- Log into Facebook in your browser
- Open Developer Tools → Application/Storage → Cookies
- Export cookies as JSON array to
facebook.json
Example facebook.json:
[
{
"name": "c_user",
"value": "123456789",
"domain": ".facebook.com",
"path": "/",
"secure": true
}
]
Method 2: Environment Variable
export FACEBOOK_COOKIE='c_user=123; xs=token; fr=request'
Method 3: URL Parameter (Highest Priority)
GET /api/facebook?q=laptop&cookies=[{"name":"c_user","value":"123",...}]
eBay (ebay.json)
eBay has aggressive bot detection that blocks requests without valid session cookies.
Setup Methods
Method 1: Cookie File (Lowest Priority)
- Log into eBay in your browser
- Open Developer Tools → Network tab
- Visit ebay.ca and inspect any request headers
- Copy the full
Cookieheader value - Save as plain text to
ebay.json(seeebay.json.example)
Example ebay.json:
s=VALUE; ds2=VALUE; ebay=VALUE; dp1=VALUE; nonsession=VALUE
Method 2: Environment Variable
export EBAY_COOKIE='s=VALUE; ds2=VALUE; ebay=VALUE'
Method 3: URL Parameter (Highest Priority)
GET /api/ebay?q=laptop&cookies=s=VALUE;ds2=VALUE;ebay=VALUE
Important Notes
- Cookies must be from active browser sessions
- Cookies expire and need periodic refresh
- NEVER commit real cookies to version control
- Platforms may still block automated scraping despite valid cookies
Security
All *.json files in this directory are git-ignored for security.