K
K
KudashVillie2018-09-01 15:49:34
Python
KudashVillie, 2018-09-01 15:49:34

How to display information from the site. Python?

I started learning python 3 days ago. I would like to know how you can display information from the site (in my case, VK) and that it would be displayed in the console. Is there any template?
Infa:
1) Number of messages
2) Number of notifications
3) For example, you can display your full name
On the Internet, I found a sample program for displaying the weather. I tried to remake it under VK - in vain.

import requests
import html2text
import bs4

s=requests.get('https://sinoptik.com.ru/погода-черемушки')
b=bs4.BeautifulSoup(s.text, "html.parser")
p3=b.select('.temperature .p3')
pogoda1=p3[0].getText()
p4=b.select('.temperature .p4')
pogoda2=p4[0].getText()
p5=b.select('.temperature .p5')
pogoda3=p5[0].getText()
p6=b.select('.temperature .p6')
pogoda4=p6[0].getText()
print('Утром :' + pogoda1 + ' ' + pogoda2)
print('Днём :' + pogoda3 + ' ' + pogoda4)
p=b.select('.rSide .description')
pogoda=p[0].getText()
print(pogoda.strip())

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Helow19274, 2018-09-01
@Helow19274

Full name and messages can be received through the API.
https://vk.com/dev/manual
Python library: https://github.com/python273/vk_api
See examples folder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question