D
D
De4oult2021-09-14 11:39:59
In contact with
De4oult, 2021-09-14 11:39:59

How to interact with the site programmatically?

I am writing a program for home use.
Voice assistant in Python. Through the VK API, I implemented sending messages, there are also functions for turning off the PC, voicing the date, time and day of the week, and some others.
I want to implement switching music in VK, but it doesn't work.
In the source code, VK found JS functions that are responsible for switching music, can they be programmed somehow into the Google Chrome console?

There is also another idea with the launch of Google Chrome snippets with a JS function, but I also did not find information on their programmatic launch.

It would be desirable to understand with program interaction with the sites.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vindicar, 2021-09-14
@Vindicar

You need to be more specific about the problem.
If you want to send a request to a simple site (simulate the opening of a link), then this is one task. It will be enough to use a library like requests.
If you want to work with a site that is hung with javascript (like VK), then this is another matter. Here, requests will not be enough, or it will be difficult to use it due to the need to pick up the site device. You need to use a headless browser like selenium. But the results of working with the site will be "locked" in the script, i.e. things like listening to music from the site will already be problematic.
However, selenium seems to be able to work with a regular browser window, read the docks on it. If so, then it should suit your task.
Finally, if nothing else helps, pywinauto or pyautogui allows you to simulate mouse clicks and keystrokes in windows of other applications. pywinauto is less popular, but pyautogui requires the application to be in the foreground.

A
Alexander, 2021-09-14
@avorsa

Off. ways to work with music through the VK API were covered in 2016.
Now only privately deal with the support service (if you have some kind of interesting application, for example).
Or look for some workarounds.

P
Puma Thailand, 2021-09-14
@opium

If your Google Chrome is working, just click on the next song button in VK

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question