DCASE-REPO / dcase_util

A collection of utilities for Detection and Classification of Acoustic Scenes and Events
https://dcase-repo.github.io/dcase_util/
MIT License
129 stars 33 forks source link

Load from youtube is not working #44

Open lesept777 opened 9 months ago

lesept777 commented 9 months ago

Description

Load from youtube is not working

Steps/Code to Reproduce

audio_container = dcase_util.containers.AudioContainer().load_from_youtube( query_id='2ceUOv8A3FE', start=1, stop=5 )

Expected Results

Actual Results

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:815 in wrapper return func(self, *args, **kwargs)

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:836 in __extract_info ie_result = ie.extract(url)

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\extractor\common.py:534 in extract ie_result = self._real_extract(url)

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\extractor\youtube.py:1794 in _real_extract 'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\extractor\common.py:1012 in _search_regex raise RegexNotFoundError('Unable to extract %s' % _name)

RegexNotFoundError: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_youtube_dl.py:40 in _fetch_basic self._ydl_info = ydl.extract_info(self.videoid, download=False)

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:808 in extract_info return self.__extract_info(url, ie, download, extra_info, process)

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:824 in wrapper self.report_error(compat_str(e), e.format_traceback())

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:628 in report_error self.trouble(error_message, tb)

File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:598 in trouble raise DownloadError(message, exc_info)

DownloadError: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1182 in load_from_youtube youtube_audio = pafy.new(

File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_shared.py:386 in getbestaudio if not self.audiostreams:

File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_shared.py:176 in audiostreams self._process_streams()

File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_youtube_dl.py:81 in _process_streams self._fetch_basic()

File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_youtube_dl.py:43 in _fetch_basic raise IOError(str(e).replace('YouTube said', 'Youtube says'))

OSError: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

Cell In[41], line 1 audio_container = dcase_util.containers.AudioContainer().load_from_youtube(

File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1263 in load_from_youtube raise IOError(e.message)

AttributeError: 'OSError' object has no attribute 'message'

The link 'https://yt-dl.org/update' answer 'Access denied'

Versions

Windows-10-10.0.19045-SP0 Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] NumPy 1.24.1 SciPy 1.10.1 Matplotlib 3.7.1 librosa 0.10.0.post2

toni-heittola commented 7 months ago

This error is related to youtube-dl library. The current release does not have a fix for this yet; however, you can install the current version from GitHub: pip install --upgrade --force-reinstall "git+https://github.com/ytdl-org/youtube-dl.git"

After this, there is an additional error in the Pafy library, which works on top of the youtube-dl. This is related to changes YouTube has made to metadata structure. Currently, there is no fix for this in pafy code base. I will leave this issue open until there is a workable fix.