> For the complete documentation index, see [llms.txt](https://aviddot-2-0.gitbook.io/aviddot-2.0-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aviddot-2-0.gitbook.io/aviddot-2.0-guide/overview/how-to-setup-telegram-scraper.md).

# How to setup Telegram Scraper

Guide to setup telegram scraper

{% hint style="warning" %}
Before being able to use the Telegram scraper, you need to follow the following steps to create the necessary files.
{% endhint %}

Follow this tutorial on YouTube to obtain the required data:

{% embed url="<https://www.youtube.com/watch?ab_channel=Bemro&v=8naENmP3rg4>" %}
Obtain API hash and API id
{% endembed %}

Now you can fill in the tg\_config.json configuration file as shown in the following image.

<br>

<figure><img src="https://551507561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqFijxcld5rWpFzWZOsEc%2Fuploads%2FYmVg5wtUqX68NYaBGh0h%2Fapi%20development1.png?alt=media&amp;token=906521e6-630d-44a6-b258-bbbf2627a3a2" alt=""><figcaption><p>tg_config.json example</p></figcaption></figure>

{% hint style="info" %}
The phone number should have the international prefix.
{% endhint %}

{% hint style="danger" %}
Note that the channels must be setted to 0 when you run the session creator
{% endhint %}

You can run now the file named session\_creator in the bot folder

&#x20;A Terminal window will show up and you will receive a message on telegram with a 6 digit code

Enter the code in the terminal and press enter

{% hint style="danger" %}
If you have protected your telegram account with a password, you will need to enter it in the terminal
{% endhint %}

Check in the bot folder that the .session file is created.

<figure><img src="https://551507561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqFijxcld5rWpFzWZOsEc%2Fuploads%2FDrg8gJk0wiQEe8awGmaD%2Fsessions.png?alt=media&amp;token=cf4fdbce-89c4-43c7-ba86-06a66446a671" alt=""><figcaption><p>session files example</p></figcaption></figure>

This file must remain in the same folder as the bot when it is running

You can now use the telegram scraper in the bot

## MAC users

For MAC users the usual rule applies. all files (including the session\_creator file) must be placed in the HOME FOLDER. The rest of the procedure is identical
