Skip to main content
Glama
DLHellMe
by DLHellMe

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

Implementation Reference

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

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