youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit e5d1f9e50aa43af014fd20f4c304b2bd5f9ebe70
parent 7ee50ae7b51ea24362419885964c11f3f7fcbb30
Author: Sergey M <dstftw@gmail.com>
Date:   Tue,  4 Feb 2014 22:35:22 +0700

[m6] Add support for m6.fr (Closes #2313)

Diffstat:
Myoutube_dl/extractor/__init__.py | 1+
Ayoutube_dl/extractor/m6.py | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py @@ -118,6 +118,7 @@ from .lynda import ( LyndaIE, LyndaCourseIE ) +from .m6 import M6IE from .macgamestore import MacGameStoreIE from .malemotion import MalemotionIE from .mdr import MDRIE diff --git a/youtube_dl/extractor/m6.py b/youtube_dl/extractor/m6.py @@ -0,0 +1,56 @@ +# encoding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + + +class M6IE(InfoExtractor): + IE_NAME = 'm6' + _VALID_URL = r'http://(?:www\.)?m6\.fr/[^/]+/videos/(?P<id>\d+)-[^\.]+\.html' + + _TEST = { + 'url': 'http://www.m6.fr/emission-les_reines_du_shopping/videos/11323908-emeline_est_la_reine_du_shopping_sur_le_theme_ma_fete_d_8217_anniversaire.html', + 'md5': '242994a87de2c316891428e0176bcb77', + 'info_dict': { + 'id': '11323908', + 'ext': 'mp4', + 'title': 'Emeline est la Reine du Shopping sur le thème « Ma fête d’anniversaire ! »', + 'description': 'md5:1212ae8fb4b7baa4dc3886c5676007c2', + 'duration': 100, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + rss = self._download_xml('http://ws.m6.fr/v1/video/info/m6/bonus/%s' % video_id, video_id, + 'Downloading video RSS') + + title = rss.find('./channel/item/title').text + description = rss.find('./channel/item/description').text + thumbnail = rss.find('./channel/item/visuel_clip_big').text + duration = int(rss.find('./channel/item/duration').text) + view_count = int(rss.find('./channel/item/nombre_vues').text) + + formats = [] + for format_id in ['lq', 'sd', 'hq', 'hd']: + video_url = rss.find('./channel/item/url_video_%s' % format_id) + if video_url is None: + continue + formats.append({ + 'url': video_url.text, + 'format_id': format_id, + }) + + return { + 'id': video_id, + 'title': title, + 'description': description, + 'thumbnail': thumbnail, + 'duration': duration, + 'view_count': view_count, + 'formats': formats, + }+ \ No newline at end of file