Telegram Bot in Python for automated reposting from VKontakte community pages (groups or public pages) to Telegram channels.
What bot can post to Telegram | How bot works | Installation & Usage
rus: Телеграм бот для автоматического парсинга (репоста) постов из пабликов ВК в Телеграм каналы
| Type of VK post | Can it? | Notes |
|---|---|---|
| Text of posts | Yes | |
| Photos of posts | Yes | |
| Links of posts | Yes | |
| YT/VK videos of posts | Yes | Bot will attach video links to posts. |
| Polls of posts | No | |
| VK reposts of posts | Yes | |
| Documents | Yes |
skip_ads_posts = True- Bot requests and receives data (posts) from VK via vk api (get.wall method).
- Then the bot compares ID from last_known_id.txt with ID of the last received post.
- If the ID from the file is less than the ID of the received posts, bot will parse and send new posts to Telegram and write the new ID to the file.
- The bot then waits for the period set by the user in
config.pyand starts again.
# clone the repo
$ git clone https://github.com/alcortazzo/vktgbot.git
# change the working directory to vktgbot
$ cd vktgbot
# install python3 and python3-pip if they are not installed
# install the requirements
$ python3 -m pip install -r requirements.txtOr launch it in docker
If you want to use git
# clone the repo
git clone https://github.com/alcortazzo/vktgbot.git
# change the working directory to vktgbot
cd vktgbot
# install python3 and python3-pip if they are not installed
# install the requirements
python -m pip install -r requirements.txtIf you don't want to use git
- Download vktgbot repo as ZIP
- Unzip vktgbot to your folder (for example C:\Users\%username%\bots\)
- Then open cmd or powershell
# change the working directory to vktgbot
cd c:\\users\\%username%\\bots\\vktgbot
# install the requirements
python -m pip install -r requirements.txttg_channel = "@aaaa"
tg_bot_token = "1234567890:AAA-AaA1aaa1AAaaAa1a1AAAAA-a1aa1-Aa"
vk_token = "00a0a0ab00f0a0ab00f0a6ab0c00000b0f000f000f0a0ab0a00b000000dd00000000de0"
vk_domain = ["aaa", "bbbb"]tg_channelis link or ID of the Telegram channel. You must add bot to this channel as an administrator!tg_bot_tokenis token for your Telegram bot. You can get it here: BotFather.vk_tokenis personal token for your VK profile. You can get it here: HowToGet.vk_domainis part of the link (after vk.com/) to the VK channel. For example, if link isvk.com/durov, you should set= ["durov"]. You can use multiple channels.
proxy_enable = True
proxy_login = "bot"
proxy_pass = "12345"
proxy_ip = "myproxy.com"
proxy_port = "1234"- For example, if the link to post is
https://vk.com/wall-22822305_1070803, then the id of that post will be1070803. - PhotoExemple
$ python3 bot.pypython bot.pydocker build -t vktgbot .
docker run -dt --name vktgbot vktgbotView logs: docker logs --follow vktgbot
GPLv3
Original Creator - alcortazzo