Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib.request
- import urllib.parse
- from bs4 import BeautifulSoup
- all_url_list = []
- song_url_list = []
- download_page = []
- download_link = []
- find_link_ZAYCEV_list = []
- def find_link_ZAYCEV():
- find_link = input("Link: ")
- for i in find_link:
- if i == ' ':
- find_link_ZAYCEV_list.append('+')
- else:
- find_link_ZAYCEV_list.append(i)
- find_link_join = ''.join(find_link_ZAYCEV_list)
- find_link_ZAYCEV_list.clear()
- find_link_ZAYCEV_list.append(str(find_link_join))
- def get_html(url):
- get_html_code = urllib.request.urlopen(url)
- return get_html_code.read()
- def parse_html_ZAYCEV(html):
- #-----------------Ищем ссылку на страницу с песней-----------------
- parse_html_code = BeautifulSoup(html)
- for tag_a in parse_html_code.find_all('a'):
- link = tag_a['href']
- all_url_list.append(link)
- for i in all_url_list:
- if i[:2] == '/p':
- song_url_list.append(i)
- else:
- continue
- all_url_list.clear()
- download_page.append('http://zaycev.net' + song_url_list[0])
- #------------------Ищем ссылку на трек-----------------------------
- parse_html_download = BeautifulSoup(get_html(download_page[0]))
- for tag_a in parse_html_download.find_all('a'):
- link = tag_a['href']
- all_url_list.append(link)
- for i in all_url_list:
- if i[:23] == 'http://cdndl.zaycev.net':
- download_link.append(i)
- else:
- continue
- all_url_list.clear()
- print(download_link)
- find_link_ZAYCEV()
- 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