D
D
Dream2021-07-30 13:14:55
Python
Dream, 2021-07-30 13:14:55

How to ask posts VKontakte?

How to parse VKontakte posts? I was trying to parse a specific post that gets posted every day. But to begin with, for some reason, it was not possible to parse the posts themselves.

The code:

def parser():
    request = requests.get('ссылка на группу')
    parsing = BeautifulSoup(request.content, 'html.parser')

    for value in parsing.select('._post_content > .post_content'):
        text = value.select('.post_info > .wall_text > .wall_post_text')
        print(text[0].text)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UberPool, 2021-07-30
@UberPool

Use the official API.
Methods: wall.get , newsfeed.get .
Libraries for working with the VK API in Python:
vk_api (You can find more, inserted for an example.)
Examples of using the library .
And stop reading articles/watching videos. Who is the official documentation for?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question