Examples
Update Settings
Configure YouTube Comments Scraper settings
The v1 API, for batchesSquids, tasks and runs: many calls on a schedule, delivered where you work. For one call that answers in seconds, use the API v2.
POST
https://api.lobstr.io/v1/squids/{squid_hash}Configure your YouTube Comments Scraper squid. Control sorting, reply collection, date filtering, and result limits.
Headers
AuthorizationstringheaderrequiredYour API authentication token. Value: Token YOUR_API_KEY
Content-TypestringheaderrequiredRequest body format. Value: application/json
Scraper Parameters
Set these parameters in the params object:
| Parameter | Type | Default | Description |
|---|---|---|---|
| max_results | integer | unlimited | Maximum comments to collect per video |
| max_unique_results_per_run | integer | null | Maximum unique comments across all tasks in the run |
| sort_by | string | top | Comment sort order: top (most liked first) or newest (most recent first) |
| skip_pinned_comment | boolean | false | Skip the pinned comment at the top of the thread |
| include_replies | boolean | true | Collect replies to top-level comments |
| max_replies | integer | unlimited | Maximum replies to collect per comment. Only applies when include_replies is true |
| fetch_since | string | null | Only collect comments published after this date. Accepts YYYY-MM-DD HH:MM:SS or a relative value (24h, 7d, 30d) |
| fetch_since_timezone | string | UTC | Timezone for fetch_since. Example: Europe/Paris |
Squid Settings
| Setting | Type | Description |
|---|---|---|
| name | string | Display name for your squid |
| concurrency | integer | Number of parallel tasks (default: 1) |
| export_unique_results | boolean | Export only unique comments |
| to_complete | boolean | Run until all tasks complete |
| no_line_breaks | boolean | Remove line breaks from text fields |
max_replies is only relevant when include_replies is true. Set it to cap reply collection on highly-commented threads.
Code Examples
curl -X POST "https://api.lobstr.io/v1/squids/YOUR_SQUID_HASH" \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "YouTube Comments (1)", "concurrency": 1, "params": { "sort_by": "top", "include_replies": true, "max_replies": 50, "skip_pinned_comment": false, "fetch_since": "7d" } }'
Response
201
{ "name": "YouTube Comments (1)", "concurrency": 1, "params": { "sort_by": "top", "include_replies": true, "max_replies": 50, "skip_pinned_comment": false, "fetch_since": "7d" } }