I'm trying to download songs or any audio from youtube using a website converter, so i develop this little code to go on youtube, find the song then take it straight to a website to download the mp3, but i can't figure out how to click the download button, is it even possible? i tried to inspect the source but i see nothing clickable? any recommendations?
from datetime import datetime
import re
import urllib
import os
from bs4 import BeautifulSoup
import sys
import requests
def songs():
song = 'taylor swift love story'
try:
query_string = urllib.parse.urlencode({"search_query" : song})
content = urllib.request.urlopen("http://www.youtube.com/results?" + query_string)
search_results = re.findall(r'href=\"\/watch\?v=(.{11})', content.read().decode())
except:
print('Something happened!!')
exit(1)
downOnly = 'https://savemp3.cc/download?video=' + 'http://www.youtube.com/watch?v=' + search_results[0]
r = requests.get(downOnly)
songs()
Aucun commentaire:
Enregistrer un commentaire