Answer the question
In order to leave comments, you need to log in
How to make an online vk parser and send notifications to telegrams?
Help me make a program in python
Essence: parsing online of a certain id in VKontakte ..
If a person went online, a telegram message "online" comes in, and then we start checking his exit from the network (parsing offline) and a notification is also received in telegram
Answer the question
In order to leave comments, you need to log in
Once every 5 minutes, request from VK using the users.get() method with fields user_ids=12345
and fields=online
information about the current online / offline account.
Store the next result of checks in the database, Redis, in a text file, in the VK itself using the storage set()
method
Compare with the previously saved value. If it has changed, send a message to Telegram :
I think that for your purposes, it will be enough to store data about the current (online / offline) state in the RAM allocated to the application. Those. stupid in code.
Another thing is storing data about which id from vk we generally track - find the simplest solution in your language and use it.
The tg-bot code will be simple. The logic there is this: everyone who wrote the bot, from the point of view of the code, is a "dialog" that has a unique id.
The bot has a .send(dialog id, message text) method.
The mailing is done by a cycle through the list of dialogs - it can be fetched from tg each time, it can be stored somewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question