mardi 27 août 2019

Python - Scrape MP3 From Site

i want to download some audio from youtube, but i want to use a website service to convert the videos to mp3's but i can't figure out how to get to the download part, anyone with beautifulsoup experience could guide me?

here is my code so far:

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