Python: Youtube-dl Status After Conversion To Mp3
I'm writing a script to download mp3 songs from web. first i'll be scraping in youtube. if found, download it using youtube-dl and convert it to mp3. If not found(done by using os.
Solution 1:
Finally, I was able to find out why. It seems %(title)s.%(ext)s
only seems to hold values inside ydl_opts dict. this answer helped me.
I changed my code inside dl_frm_youtube to this:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
#ydl.download([yt_lnk])
info = ydl.extract_info(yt_lnk, download=True)
songname = info.get('title', None)
#print(songname)if os.path.isfile(dlpath+'\\'+songname+'.mp3'):
print('found')
and it works perfectly. Answering it in case if someone find it useful.
Post a Comment for "Python: Youtube-dl Status After Conversion To Mp3"