Бот парсер телеграм python

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Python program designed to scrape posts from Telegram channels using HTTP requests and HTML parsing, rather than Telegrams API. This is useful, as selfbots are against Telegram’s ToS.

License

Steelio/Telegram-Post-Scraper

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Telegram Post Scraper via Python

Telegram-Post-Scraper is a Python program designed to scrape posts from Telegram channels using HTTP requests and HTML parsing, rather than Telegram’s API. This program is useful when creating bots or using Telegram’s API is not feasible or against Telegram’s terms of service. TG-Post-Scraper also has the capabilities to download multimedia, videos and images from a Telegram post. Atop of this, it offers the ability to save posts and the bulk data to text files for ease of access.

• Version 2.0 released. Code was rewritten. Should be more efficient. • Added support for multiple links. Separate with a comma. Link Ex: (t.me/somegroup/540,t.me/someothergroup/250) • Added video downloading support. •• If you find any bugs please submit an issue ticket. Whipped this up semi-buzzed. So I may have overlooked something. Much love, enjoy y'all ♥ 
  • Scrapes posts from Telegram channels using HTTP requests and HTML parsing.
  • Can copy the content of the posts, and download media such as images and videos.
  • Supports scraping multiple links in one session. Seperate links at the beginning of the program with commas. (t.me/groupID/333,t.me/someotherID/444,t.me/anotherOne/555)
  • Does not require a bot or an API key.
  • Useful for situations where using Telegram’s API or creating a bot is not feasible or against Telegram’s terms of service.
Читайте также:  Php код для обновления страницы

To use Telegram-Post-Scraper, you need to have Python 3 installed on your system, as well as the following Python packages: This program was built on Python 3.10.10 64bit

You can install these packages using pip by running the following command:

pip install -r requirements.txt 

To use Telegram-Post-Scraper, you just provide it with a URL of a Telegram post.

1. Open Command Prompt, Powershell, or Terminal. 2. Run "py(thon3) main.py" 3. Enter your Telegram post URL. (Format: https://t.me/SOMEGROUP/NUMERICID) 3a. You can find the link of a Telegram post by right clicking it and pressing "Copy Link". 4. Follow through the prompts in the console window. 

If you find any bugs or have suggestions for improvements, feel free to create an issue or submit a pull request.

Was this program useful to you? If you want to donate ♥ :

BTC: bc1qvrm0tepx6jdxcsr99z5xqmswcl9ad333nenkeg LTC: LSuSA99uMbC1BtQ4eJxpczAsv3W7KbtahF

About

Python program designed to scrape posts from Telegram channels using HTTP requests and HTML parsing, rather than Telegrams API. This is useful, as selfbots are against Telegram’s ToS.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Parse Telegram channels and users

License

alevikpes/telegram-parser

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Читайте также:  Java awt event windowadapter windowclosing

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This script logs in as a user and can perform actions on behalf of the currently logged in user.

At the moment it can get all the groups, where the user is subscribed and get a list of users of some of those groups. This script cannot get the users of any group due to some kind of restrictions, which the group admins place for in the groups.

In order to start using this bot, it is necessary to obtain API ID and API HASH for your user account.

It can be done via https://my.telegram.org/. Enter your phone number, verify with the sent code and go to the API Development Tools page. There create an app and copy API ID and API HASH.

If there is a plan to use a bot, then the bot must be created via the BotFather in any Telegram application. See Telegram instructions. Such bot will have a name and a token, which also must be stored.

NOTE Bots cannot perform all the actions, so the creation of the user application, as desribed above, may be necessary for certain tasks.

WARNING Never give anyone the credentials of neither your user application nor your bot. Also add to the ignore list of your VCS, the files, which have the credentials stored.

Create a file .env and save there the API ID, the API HASH, the bot name, the bot token, a database name (can be any), a session name (can be any) and, possibly, other required data in the following format:

APP_API_HASH= APP_API_ID= DB_NAME= SESSION_NAME= TG_BOT_NAME= TG_BOT_TOKEN= . 

NOTE Do not use spaces or other special characters in your custom names.

WARNING Never give anyone the credentials of neither your user application nor your bot. Also add to the ignore list of your VCS, the files, which have the credentials stored.

Create a python virtual environment (search online about how to do it for your OS). On Linux Debian distros it can be done with:

sudo apt install python3-venv -y python3 -m venv /path/to/virtual-environment

Start your virtual environment:

source /path/to/virtual-environment/bin/activate
pip3 install -r requirements.txt

This will create an sqlite database file with two tables group and user . The name of the file will be read from the .env file. See init.py for more details.

After the initialisation it is all ready for parsing channels and users.

NOTE Always start your virtual environment before executing the sripts:

source /path/to/virtual-environment/bin/activate

Run main.py to start the parsing:

Читайте также:  Javascript document load script

The script will parse the channels and save their info and the data of the participants of those channels into the database.

In order to parse only one channel, use -g optional argument with the cahnnel username (the name which starts with @ symbol and can be found in the channel info page, specifying @ is not necessary):

python3 main.py -g channel username>

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

ettercaper/TelegramParserBot

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Бот для парсинга информации в телеграме. Ниже описана инструкция по настройке.

Установка зависимостей >> Скачивание файлов программы >> Получение API ключей >> Первичная настройка >> Запуск

В следующей команде описана установка двух библиотек. Достаточно будет одной ( pyrogram ) , но разработчик рекомендует установить и tgcrypto . С ним бот работает на порядок быстрее.

pip install pyrogram tgcrypto

В консоли переходим в директорию где будет находиться бот и выполняеем следующую команду:

git clone https://github.com/ettercaper/TelegramParserBot.git

Далее нужно получить api_id и api_hash для аккаунта в телеге с которого будем парсить контент.

  1. Переходим по ссылке my.telegram.org/apps.
  2. Логинимся в системе, и заполняем все необходимые поля.
  3. Полученные по итогу api_id и api_hash надо вписать в файл config.ini в соответствующие строки.

При первом запуске консоль запросит авторизацию.

Сначала надо будет ввести номер телефона в международном формате, потом код который придёт в самом мессенджере. Если установлен пароль на вход, то и его тоже запросит. После этого будет создан файл в корневой директории: account.session — это файл сессии, через него программа будет авторизовываться в последующие запуски.

На этом настройка закончена, жмём CTRL+C для выхода из программы. И можно запускать бот снова.

Источник

Оцените статью