I have written a small piece of code in python to extract the audio from a YouTube video. Here is the code:
from __future__ import unicode_literals
import youtube_dl
link = input("Enter the video link:")
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
info_dict = ydl.extract_info(link, download=False)
video_title = info_dict.get('title', None)
path = f'D:\\{video_title}.mp3'
ydl_opts.update({'outtmpl':path})
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([link])
This is the folder where the output audio file is saved:

As you can see, all the details of the audio file are displayed, such as Date Modified, Type and Size.
However, if I change path = f'D:\\{video_title}.mp3' to path = f'D:\\YT_Files\\{video_title}.mp3', then the file details are not getting displayed.

Any idea about why this is so? Is there any way to solve this problem? Any help would be appreciated. Thanks.