Skip to main content
Glama

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
NameRequiredDescriptionDefault
date_fromYesStart date in ISO format (e.g., 2024-01-01)
date_toNoEnd date in ISO format (e.g., 2024-01-31)
urlYesThe Telegram channel/group URL

Implementation Reference

  • 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'] } },
  • 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'] }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DLHellMe/telegram-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server