serp_youtube_locations
Retrieve available geographic locations for YouTube SERP data analysis to ensure accurate regional targeting and content performance tracking across organic results, video information, comments, and subtitles.
Instructions
Utility tool to get list of available locations for: serp_youtube_organic_live_advanced, serp_youtube_video_info_live_advanced, serp_youtube_video_comments_live_advanced, serp_youtube_video_subtitles_live_advanced.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country_iso_code | Yes | ISO 3166-1 alpha-2 country code, for example: US, GB, MT | |
| location_name | No | Name of location or it`s part. | |
| location_type | No | Type of location. Possible variants: 'TV Region','Postal Code','Neighborhood','Governorate','National Park','Quarter','Canton','Airport','Okrug','Prefecture','City','Country','Province','Barrio','Sub-District','Congressional District','Municipality District','district','DMA Region','Union Territory','Territory','Colloquial Area','Autonomous Community','Borough','County','State','District','City Region','Commune','Region','Department','Division','Sub-Ward','Municipality','University' |
Implementation Reference
- The handle() method executes the tool logic: constructs the request payload from parameters and sends a POST request to the DataForSEO /v3/serp/youtube/locations endpoint, then formats the response.async handle(params:any): Promise<any> { try { const payload: Record<string, unknown> = { 'country_iso_code': params.country_iso_code, }; if (params.location_type) { payload['location_type'] = params.location_type; } if (params.location_name) { payload['location_name'] = params.location_name; } const response = await this.dataForSEOClient.makeRequest(`/v3/serp/youtube/locations`, 'POST', [payload]); return this.validateAndFormatResponse(response); } catch (error) { return this.formatErrorResponse(error); } }
- Defines the input schema using Zod for parameters: country_iso_code (required), location_type and location_name (optional).getParams(): z.ZodRawShape { return { country_iso_code: z.string().describe("ISO 3166-1 alpha-2 country code, for example: US, GB, MT"), location_type: z.string().optional().describe("Type of location. Possible variants: 'TV Region','Postal Code','Neighborhood','Governorate','National Park','Quarter','Canton','Airport','Okrug','Prefecture','City','Country','Province','Barrio','Sub-District','Congressional District','Municipality District','district','DMA Region','Union Territory','Territory','Colloquial Area','Autonomous Community','Borough','County','State','District','City Region','Commune','Region','Department','Division','Sub-Ward','Municipality','University'"), location_name: z.string().optional().describe("Name of location or it`s part.") }; }
- src/core/modules/serp/serp-api.module.ts:19-19 (registration)Instantiates the SerpYoutubeLocationsListTool within the SerpApiModule's getTools() method, adding it to the list of tools that will be registered with their name, description, params, and handler.new SerpYoutubeLocationsListTool(this.dataForSEOClient),
- Returns the tool name 'serp_youtube_locations' used for registration in the module.getName(): string { return 'serp_youtube_locations'; }
- src/core/modules/serp/serp-api.module.ts:10-10 (registration)Imports the SerpYoutubeLocationsListTool class from its file for use in the module.import { SerpYoutubeLocationsListTool } from './tools/serp-youtube-locations-list.tool.js';