Skip to content

Telegram Bot for repost from VK to TG channel

License

Notifications You must be signed in to change notification settings

idonotknowwhoiam/vktgbot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vktgbot fork with multiple vk domains posting

docker image

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: Телеграм бот для автоматического парсинга (репоста) постов из пабликов ВК в Телеграм каналы

What bot can post to Telegram

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

In addition, the bot can skip advertising posts if in config.py

skip_ads_posts = True

How bot works

  • 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.py and starts again.

Installation & Usage

Linux or macOS

# 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.txt

Or launch it in docker

Windows

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.txt

If you don't want to use git

  1. Download vktgbot repo as ZIP
  2. Unzip vktgbot to your folder (for example C:\Users\%username%\bots\)
  3. 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.txt

Open config file and update the following variables:

tg_channel = "@aaaa"
tg_bot_token = "1234567890:AAA-AaA1aaa1AAaaAa1a1AAAAA-a1aa1-Aa"
vk_token = "00a0a0ab00f0a0ab00f0a6ab0c00000b0f000f000f0a0ab0a00b000000dd00000000de0"
vk_domain = ["aaa", "bbbb"]
  • tg_channel is link or ID of the Telegram channel. You must add bot to this channel as an administrator!
  • tg_bot_token is token for your Telegram bot. You can get it here: BotFather.
  • vk_token is personal token for your VK profile. You can get it here: HowToGet.
  • vk_domain is part of the link (after vk.com/) to the VK channel. For example, if link is vk.com/durov, you should set = ["durov"]. You can use multiple channels.

If Telegram is not available in your country, you should update these variables.

proxy_enable = True
proxy_login = "bot"
proxy_pass = "12345"
proxy_ip = "myproxy.com"
proxy_port = "1234"

Open file last_known_id.txt and write the ID of the last post (not pinned!) into it:

  • For example, if the link to post is https://vk.com/wall-22822305_1070803, then the id of that post will be 1070803.
  • PhotoExemple

Launch the bot

Linux or macOS

$ python3 bot.py

Windows

python bot.py

Docker (58MB)

docker build -t vktgbot .
docker run -dt --name vktgbot vktgbot

View logs: docker logs --follow vktgbot

License

GPLv3
Original Creator - alcortazzo

About

Telegram Bot for repost from VK to TG channel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.7%
  • Dockerfile 1.3%