Guest User

Untitled

a guest
Oct 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import lxml.html
  2. import requests
  3. import re
  4. from itertools import islice
  5. from bs4 import BeautifulSoup
  6. import bot_vk
  7.  
  8. login = 'login'
  9. password = 'mypassword'
  10. url = 'http://vk.com/'
  11. vk = bot_vk.auth_vk(login = login,password=password)
  12. headers = {
  13. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)',
  14. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  15. 'Accept-Language':'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
  16. 'Accept-Encoding':'gzip, deflate',
  17. 'Connection':'keep-alive',
  18. 'DNT':'1'
  19. }
  20. #авторизовываемя для получения музыки
  21. session = requests.session()
  22. data = session.get(url, headers=headers)
  23. page = lxml.html.fromstring(data.content)
  24.  
  25. form = page.forms[0]
  26. form.fields['email'] = login
  27. form.fields['pass'] = password
  28.  
  29. response = session.post(form.action, data=form.form_values())
  30. while True:
  31. response = session.post("https://vk.com/audios"+str(input()))
  32. #print(response.text)
  33.  
  34.  
  35. #da = re.findall('data-audio="[(.+)]',response.text)
  36. da = re.findall('data-full-id="(.+?)"',response.text)
  37. print(da)
  38.  
  39. qiy = ""
  40. for i in da:
  41. qiy+="audio"+str(i)+","
  42. qiy.split(",")
Add Comment
Please, Sign In to add comment