Repository: ytdl-org/youtube-dl

Issue:
site request: http://live.philharmoniedeparis.fr/Concerts.html
Hello,
it would be nice to get support for the Paris' Philarmonie streaming service.
It is currently not supported by the generic extractor:

$ youtube-dl.exe -v http://live.philharmoniedeparis.fr/concert/1030324/orchestre-philharmonique-de-
radio-france-myung-whun-chung.html
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'http://live.philharmoniedeparis.fr/concert/1030324/orchestre-ph
ilharmonique-de-radio-france-myung-whun-chung.html']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2015.04.17
[debug] Python version 2.7.8 - Windows-8-6.2.9200
[debug] exe versions: ffmpeg N-69608-g9dc45d1
[debug] Proxy map: {}
[generic] orchestre-philharmonique-de-radio-france-myung-whun-chung: Requesting header
WARNING: Falling back on generic information extractor.
[generic] orchestre-philharmonique-de-radio-france-myung-whun-chung: Downloading webpage
[generic] orchestre-philharmonique-de-radio-france-myung-whun-chung: Extracting information
ERROR: Unsupported URL: http://live.philharmoniedeparis.fr/concert/1030324/orchestre-philharmonique-
de-radio-france-myung-whun-chung.html
Traceback (most recent call last):
  File "youtube_dl\extractor\generic.pyo", line 923, in _real_extract
  File "youtube_dl\utils.pyo", line 1531, in parse_xml
  File "xml\etree\ElementTree.pyo", line 1300, in XML
  File "xml\etree\ElementTree.pyo", line 1642, in feed
  File "xml\etree\ElementTree.pyo", line 1506, in _raiseerror
ParseError: mismatched tag: line 152, column 2
Traceback (most recent call last):
  File "youtube_dl\YoutubeDL.pyo", line 651, in extract_info
  File "youtube_dl\extractor\common.pyo", line 275, in extract
  File "youtube_dl\extractor\generic.pyo", line 1442, in _real_extract
UnsupportedError: Unsupported URL: http://live.philharmoniedeparis.fr/concert/1030324/orchestre-phil
harmonique-de-radio-france-myung-whun-chung.html

In the HTML source, the script just after the header calls a flash player (src: '/Player/lecteur_video.swf'), with a path to an xml file (e.g. flashvars: { fichier_nom: '/misc/Playlist.ashx?id=1030324&track=&lang=fr', ...).
This xml file (http://live.philharmoniedeparis.fr/misc/Playlist.ashx?id=1030324&track=&lang=fr) shows to rtmp links:
rtmp://fms.8F13.edgecastcdn.net/008F13/vod/PPVI/PPVI000221700/PPVI000221701/PPVI000221701_00_Lt.mp4 (standard definition),
rtmp://fms.8F13.edgecastcdn.net/008F13/vod/PPVI/PPVI000221700/PPVI000221701/PPVI000221701_00_Ht.mp4 (high definition).

It's possible to read such a stream with e.g. VLC, so I suppose it should be possible to integrate within youtube-dl (excellent soft, by the way !).
Thanks



Discussion:

Resolving patch:
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -377,6 +377,7 @@
 from .parliamentliveuk import ParliamentLiveUKIE
 from .patreon import PatreonIE
 from .pbs import PBSIE
+from .philharmoniedeparis import PhilharmonieDeParisIE
 from .phoenix import PhoenixIE
 from .photobucket import PhotobucketIE
 from .planetaplay import PlanetaPlayIE
diff --git a/youtube_dl/extractor/philharmoniedeparis.py b/youtube_dl/extractor/philharmoniedeparis.py
new file mode 100644
--- /dev/null
+++ b/youtube_dl/extractor/philharmoniedeparis.py
@@ -0,0 +1,77 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+    determine_ext,
+    int_or_none,
+    parse_iso8601,
+    unified_strdate,
+)
+
+class PhilharmonieDeParisIE(InfoExtractor):
+    _VALID_URL = r'http://live\.philharmoniedeparis\.fr/concert/(?P<id>\d+)(?:/|\.html)'
+    _TESTS = [{
+        'url': 'http://live.philharmoniedeparis.fr/concert/1032066.html',
+        'info_dict': {
+            'id': '1032066',
+            'ext': 'mp4',
+            'title': "Week-end Bach. Passion selon saint Jean. Akademie für alte Musik Berlin, Rias Kammerchor, René Jacobs",
+            'upload_date': '20150404',
+        }
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+
+        webpage = self._download_webpage(url, video_id)
+        fichier_nom = self._html_search_regex(r'\sflashvars\s*:\s*\{\s*fichier_nom\s*:\s*\'(.*?)\'\s*,', webpage, 'fichier_nom')
+
+        playlist = self._download_xml('http://live.philharmoniedeparis.fr' + fichier_nom, video_id)
+
+        concert = playlist.find('.//concert')
+
+        formats = []
+        info_dict = {
+            'id': video_id,
+            'title': concert.find('./titre').text,
+            'formats': formats,
+        }
+
+        if concert.attrib.get('heure'):
+            info_dict['timestamp'] = parse_iso8601(('%s-%s-%s%s') % (
+                concert.attrib['date'][0:4],
+                concert.attrib['date'][4:6],
+                concert.attrib['date'][6:8],
+                concert.attrib['heure']
+            ))
+        else:
+            info_dict['upload_date'] = concert.attrib['date']
+
+        fichiers = concert.find('./fichiers')
+        for fichier in fichiers.findall('./fichier'):
+            # Sometimes <ficher>s have no attributes at all. Skip them.
+            if 'url' not in fichier.attrib:
+                continue
+
+            formats.append({
+                'format_id': 'lq',
+                'url': fichiers.attrib['serveurstream'],
+                'ext': determine_ext(fichier.attrib['url']),
+                'play_path': fichier.attrib['url'],
+                'width': int_or_none(concert.attrib['largeur']),
+                'height': int_or_none(concert.attrib['hauteur']),
+                'quality': 1,
+            })
+
+            formats.append({
+                'format_id': 'hq',
+                'url': fichiers.attrib['serveurstream'],
+                'ext': determine_ext(fichier.attrib['url_hd']),
+                'play_path': fichier.attrib['url_hd'],
+                'width': int_or_none(concert.attrib['largeur_hd']),
+                'height': int_or_none(concert.attrib['hauteur_hd']),
+                'quality': 2,
+            })
+
+        return info_dict


Test patch: