scrape_date_range
Extract Telegram channel or group posts within a defined date range using an authenticated session. Input includes URL, start date, and optional end date in ISO format.
Instructions
Scrape posts within a specific date range. Uses authenticated session if logged in.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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) | |
| url | Yes | The Telegram channel/group URL |
Implementation Reference
- src/server.ts:453-476 (handler)The handler function that implements the scrape_date_range tool. It determines the scraper based on authentication, parses the date range inputs, calls the scraper's scrape method with the options, formats the result to markdown, and returns it as tool 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)Registration of the scrape_date_range tool in the getTools() method, including its description and input schema definition.{ 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, defining parameters for URL and date range.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'] }