[Freesound] Unable to extract music title #11602

Closed
stepshal opened this Issue Jan 4, 2017 · 1 comment

Projects

None yet

2 participants

@stepshal
Contributor
stepshal commented Jan 4, 2017
  • I've verified and I assure that I'm running youtube-dl 2017.01.02

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other
ERROR: Unable to extract music title; 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 "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 694, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 359, in extract
    return self._real_extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/freesound.py", line 28, in _real_extract
    webpage, 'music title', flags=re.DOTALL)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 671, in _html_search_regex
    res = self._search_regex(pattern, string, name, default, fatal, flags, group)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 662, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract music title; 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.

http://www.freesound.org/people/miklovan/sounds/194503/

@shizeeg
Contributor
shizeeg commented Jan 4, 2017

a quick fix:

diff --git a/youtube_dl/extractor/freesound.py b/youtube_dl/extractor/freesound.py
index 5ff62af2a..65b2fd27d 100644
--- a/youtube_dl/extractor/freesound.py
+++ b/youtube_dl/extractor/freesound.py
@@ -23,9 +23,7 @@ class FreesoundIE(InfoExtractor):
         mobj = re.match(self._VALID_URL, url)
         music_id = mobj.group('id')
         webpage = self._download_webpage(url, music_id)
-        title = self._html_search_regex(
-            r'<div id="single_sample_header">.*?<a href="#">(.+?)</a>',
-            webpage, 'music title', flags=re.DOTALL)
+        title = self._og_search_property('audio:title', webpage, 'song title')
         description = self._html_search_regex(
             r'<div id="sound_description">(.*?)</div>', webpage, 'description',
             fatal=False, flags=re.DOTALL)
@shizeeg shizeeg added a commit to shizeeg/youtube-dl that referenced this issue Jan 5, 2017
@shizeeg shizeeg [Freesound] extended and fix "title" extraction closes #11602 e3acd54
@dstftw dstftw added a commit that closed this issue Jan 12, 2017
@shizeeg @dstftw shizeeg + dstftw [freesound] Fix extraction and extended (closes #11602) ed06da4
@dstftw dstftw closed this in ed06da4 Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment