docs: update cookies agents.md
Signed-off-by: Dmytro Stanchiev <git@dmytros.dev>
This commit is contained in:
@@ -2,16 +2,15 @@
|
|||||||
|
|
||||||
Both Facebook Marketplace and eBay require valid session cookies to bypass bot detection and access listings.
|
Both Facebook Marketplace and eBay require valid session cookies to bypass bot detection and access listings.
|
||||||
|
|
||||||
## Cookie Priority Hierarchy
|
## Cookie Configuration
|
||||||
|
|
||||||
All scrapers follow this priority order (highest to lowest):
|
Authenticated scrapers now read cookies only from environment variables:
|
||||||
1. **URL Parameter** - Passed directly in API/MCP request (overrides all)
|
1. `FACEBOOK_COOKIE`
|
||||||
2. **Environment Variable** - Set as `FACEBOOK_COOKIE` or `EBAY_COOKIE`
|
2. `EBAY_COOKIE`
|
||||||
3. **Cookie File** - Stored in `facebook.json` or `ebay.json` (fallback)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Facebook Marketplace (`facebook.json`)
|
## Facebook Marketplace
|
||||||
|
|
||||||
### Required Cookies
|
### Required Cookies
|
||||||
- `c_user`: Your Facebook user ID
|
- `c_user`: Your Facebook user ID
|
||||||
@@ -20,65 +19,27 @@ All scrapers follow this priority order (highest to lowest):
|
|||||||
- `datr`: Data attribution token
|
- `datr`: Data attribution token
|
||||||
- `sb`: Session browser token
|
- `sb`: Session browser token
|
||||||
|
|
||||||
### Setup Methods
|
### Setup
|
||||||
|
|
||||||
**Method 1: Cookie File (Lowest Priority)**
|
|
||||||
1. Log into Facebook in your browser
|
|
||||||
2. Open Developer Tools → Application/Storage → Cookies
|
|
||||||
3. Export cookies as JSON array to `facebook.json`
|
|
||||||
|
|
||||||
Example `facebook.json`:
|
|
||||||
```json
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "c_user",
|
|
||||||
"value": "123456789",
|
|
||||||
"domain": ".facebook.com",
|
|
||||||
"path": "/",
|
|
||||||
"secure": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
**Method 2: Environment Variable**
|
|
||||||
```bash
|
```bash
|
||||||
export FACEBOOK_COOKIE='c_user=123; xs=token; fr=request'
|
export FACEBOOK_COOKIE='c_user=123; xs=token; fr=request'
|
||||||
```
|
```
|
||||||
|
|
||||||
**Method 3: URL Parameter (Highest Priority)**
|
Use the raw `Cookie` header string copied from an authenticated browser session.
|
||||||
```
|
|
||||||
GET /api/facebook?q=laptop&cookies=[{"name":"c_user","value":"123",...}]
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## eBay (`ebay.json`)
|
## eBay
|
||||||
|
|
||||||
eBay has aggressive bot detection that blocks requests without valid session cookies.
|
eBay has aggressive bot detection that blocks requests without valid session cookies.
|
||||||
|
|
||||||
### Setup Methods
|
### Setup
|
||||||
|
|
||||||
**Method 1: Cookie File (Lowest Priority)**
|
|
||||||
1. Log into eBay in your browser
|
|
||||||
2. Open Developer Tools → Network tab
|
|
||||||
3. Visit ebay.ca and inspect any request headers
|
|
||||||
4. Copy the full `Cookie` header value
|
|
||||||
5. Save as plain text to `ebay.json` (see `ebay.json.example`)
|
|
||||||
|
|
||||||
Example `ebay.json`:
|
|
||||||
```
|
|
||||||
s=VALUE; ds2=VALUE; ebay=VALUE; dp1=VALUE; nonsession=VALUE
|
|
||||||
```
|
|
||||||
|
|
||||||
**Method 2: Environment Variable**
|
|
||||||
```bash
|
```bash
|
||||||
export EBAY_COOKIE='s=VALUE; ds2=VALUE; ebay=VALUE'
|
export EBAY_COOKIE='s=VALUE; ds2=VALUE; ebay=VALUE'
|
||||||
```
|
```
|
||||||
|
|
||||||
**Method 3: URL Parameter (Highest Priority)**
|
Use the raw `Cookie` header string copied from an authenticated browser session.
|
||||||
```
|
|
||||||
GET /api/ebay?q=laptop&cookies=s=VALUE;ds2=VALUE;ebay=VALUE
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -91,4 +52,4 @@ GET /api/ebay?q=laptop&cookies=s=VALUE;ds2=VALUE;ebay=VALUE
|
|||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
All `*.json` files in this directory are git-ignored for security.</content>
|
Do not commit real cookie values or store them in tracked files.
|
||||||
|
|||||||
Reference in New Issue
Block a user