Advertisement
Guest User

Untitled

a guest
Dec 4th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. import urllib.request
  2. import urllib.parse
  3. from bs4 import BeautifulSoup
  4.  
  5. all_url_list = []
  6. song_url_list = []
  7. download_page = []
  8. download_link = []
  9. find_link_ZAYCEV_list = []
  10.  
  11. def find_link_ZAYCEV():
  12. find_link = input("Link: ")
  13. for i in find_link:
  14. if i == ' ':
  15. find_link_ZAYCEV_list.append('+')
  16. else:
  17. find_link_ZAYCEV_list.append(i)
  18. find_link_join = ''.join(find_link_ZAYCEV_list)
  19. find_link_ZAYCEV_list.clear()
  20. find_link_ZAYCEV_list.append(str(find_link_join))
  21.  
  22. def get_html(url):
  23. get_html_code = urllib.request.urlopen(url)
  24. return get_html_code.read()
  25.  
  26. def parse_html_ZAYCEV(html):
  27. #-----------------Ищем ссылку на страницу с песней-----------------
  28. parse_html_code = BeautifulSoup(html)
  29. for tag_a in parse_html_code.find_all('a'):
  30. link = tag_a['href']
  31. all_url_list.append(link)
  32. for i in all_url_list:
  33. if i[:2] == '/p':
  34. song_url_list.append(i)
  35. else:
  36. continue
  37. all_url_list.clear()
  38. download_page.append('http://zaycev.net' + song_url_list[0])
  39. #------------------Ищем ссылку на трек-----------------------------
  40. parse_html_download = BeautifulSoup(get_html(download_page[0]))
  41. for tag_a in parse_html_download.find_all('a'):
  42. link = tag_a['href']
  43. all_url_list.append(link)
  44. for i in all_url_list:
  45. if i[:23] == 'http://cdndl.zaycev.net':
  46. download_link.append(i)
  47. else:
  48. continue
  49. all_url_list.clear()
  50. print(download_link)
  51.  
  52. find_link_ZAYCEV()
  53. parse_html_ZAYCEV(get_html('http://zaycev.net/search.html?query_search=' + str(find_link_ZAYCEV_list[0])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement