Repository: ytdl-org/youtube-dl

Issue:
NHL.COM URL Failure...
URL:
http://video.mapleleafs.nhl.com/videocenter/console?id=58665&catid=802 

youtube-dl.py -v http://video.mapleleafs.nhl.com/videocenter/console?id=58665&catid=802
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', 'http://video.mapleleafs.nhl.com/videocenter/console?id=58665']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2014.12.01
[debug] Python version 2.7.5 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-40824-, rtmpdump 2.4
[debug] Proxy map: {}
[nhl.com] 58665: Downloading JSON metadata
[nhl.com] 58665: Extracting information
[nhl.com] 58665: Downloading final video url
[debug] Invoking downloader on 'http://mapleleafs.cdnllnwnl.neulion.net/s/mapleleafs/vod/flv/LWEB-100128-CLASSICGI6.flv?eid=58653&pid=58665&gid=3028?eid=58653&pid=58665&gid=3028&pt=1&ip=199.85.73.12&e
=1417456874&h=181627b3cec444da4267f94da6b83915'
ERROR: unable to download video data: HTTP Error 404: Not Found
Traceback (most recent call last):
  File "C:\Transmogrifier\youtube-dl.py\youtube_dl\YoutubeDL.py", line 1087, in process_info
    success = dl(filename, info_dict)
  File "C:\Transmogrifier\youtube-dl.py\youtube_dl\YoutubeDL.py", line 1063, in dl
    return fd.download(name, info)
  File "C:\Transmogrifier\youtube-dl.py\youtube_dl\downloader\common.py", line 294, in download
    return self.real_download(filename, info_dict)
  File "C:\Transmogrifier\youtube-dl.py\youtube_dl\downloader\http.py", line 66, in real_download
    data = self.ydl.urlopen(request)
  File "C:\Transmogrifier\youtube-dl.py\youtube_dl\YoutubeDL.py", line 1321, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "C:\Python27\lib\urllib2.py", line 410, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 448, in error
    return self._call_chain(_args)
  File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
    result = func(_args)
  File "C:\Python27\lib\urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found

'catid' is not recognized as an internal or external command,
operable program or batch file.

Thanks in advance..
Ringo



Discussion:

Resolving patch:
diff --git a/youtube_dl/extractor/nhl.py b/youtube_dl/extractor/nhl.py
--- a/youtube_dl/extractor/nhl.py
+++ b/youtube_dl/extractor/nhl.py
@@ -7,6 +7,7 @@
 from ..compat import (
     compat_urlparse,
     compat_urllib_parse,
+    compat_urllib_parse_urlparse
 )
 from ..utils import (
     unified_strdate,
@@ -24,9 +25,13 @@ def _extract_video(self, info):
 
         initial_video_url = info['publishPoint']
         if info['formats'] == '1':
+            parsed_url = compat_urllib_parse_urlparse(initial_video_url)
+            path = parsed_url.path
+            extension_index = path.rfind('.')
+            path = path[:extension_index] + '_sd' + path[extension_index:]
             data = compat_urllib_parse.urlencode({
                 'type': 'fvod',
-                'path': initial_video_url.replace('.mp4', '_sd.mp4'),
+                'path': compat_urlparse.urlunparse(parsed_url[:2] + (path,) + parsed_url[3:])
             })
             path_url = 'http://video.nhl.com/videocenter/servlets/encryptvideopath?' + data
             path_doc = self._download_xml(
@@ -73,6 +78,17 @@ class NHLIE(NHLBaseInfoExtractor):
             'duration': 0,
             'upload_date': '20141011',
         },
+    }, {
+        'url': 'http://video.mapleleafs.nhl.com/videocenter/console?id=58665&catid=802',
+        'md5': 'c78fc64ea01777e426cfc202b746c825',
+        'info_dict': {
+            'id': '58665',
+            'ext': 'flv',
+            'title': 'Classic Game In Six - April 22, 1979',
+            'description': 'It was the last playoff game for the Leafs in the decade, and the last time the Leafs and Habs played in the playoffs. Great game, not a great ending.',
+            'duration': 400,
+            'upload_date': '20100129'
+        },
     }, {
         'url': 'http://video.flames.nhl.com/videocenter/console?id=630616',
         'only_matching': True,


Test patch: