scrape_date_range
Extract Telegram channel or group posts from a specific time period using authenticated sessions for targeted data collection.
Instructions
Scrape posts within a specific date range. Uses authenticated session if logged in.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The Telegram channel/group URL | |
| date_from | Yes | Start date in ISO format (e.g., 2024-01-01) | |
| date_to | No | End date in ISO format (e.g., 2024-01-31) |
Implementation Reference
- src/server.ts:453-476 (handler)The primary handler for the scrape_date_range tool. Determines if authenticated scraping is available, parses the date_from and optional date_to inputs, constructs ScrapeOptions, invokes the scraper's scrape method, formats the result using MarkdownFormatter, and returns the markdown as text content.private async handleScrapeDateRange(args: any): Promise<any> { // Check if authenticated and use authenticated scraper by default const isAuthenticated = await this.auth.isAuthenticated(); const scraperToUse = isAuthenticated ? this.authScraper : this.scraper; const options: ScrapeOptions = { url: args.url, dateFrom: parseISO(args.date_from), dateTo: args.date_to ? parseISO(args.date_to) : new Date(), includeReactions: true }; const result = await scraperToUse.scrape(options); const markdown = this.formatter.format(result); return { content: [ { type: 'text', text: markdown } ] }; }
- src/server.ts:199-220 (registration)Tool registration in getTools() method, including the name, description, and JSON input schema defining parameters for URL, date_from (required), and optional date_to.{ name: 'scrape_date_range', description: 'Scrape posts within a specific date range. Uses authenticated session if logged in.', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The Telegram channel/group URL' }, date_from: { type: 'string', description: 'Start date in ISO format (e.g., 2024-01-01)' }, date_to: { type: 'string', description: 'End date in ISO format (e.g., 2024-01-31)' } }, required: ['url', 'date_from'] } },
- src/server.ts:202-219 (schema)Input schema for the scrape_date_range tool, specifying object with url (string, required), date_from (string ISO, required), date_to (string ISO, optional).inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The Telegram channel/group URL' }, date_from: { type: 'string', description: 'Start date in ISO format (e.g., 2024-01-01)' }, date_to: { type: 'string', description: 'End date in ISO format (e.g., 2024-01-31)' } }, required: ['url', 'date_from'] }