]> gitweb @ CieloNegro.org - youtube-dl.git/blob - youtube_dl/extractor/goldenmoustache.py
Copy the mtime from the oldest source file to the file created by ffmpeg
[youtube-dl.git] / youtube_dl / extractor / goldenmoustache.py
1 from __future__ import unicode_literals
2
3 import re
4 from .common import InfoExtractor
5 from ..utils import (
6     parse_duration,
7     int_or_none,
8 )
9
10
11 class GoldenMoustacheIE(InfoExtractor):
12     _VALID_URL = r'https?://(?:www\.)?goldenmoustache\.com/(?P<display_id>[\w-]+)-(?P<id>\d+)'
13     _TESTS = [{
14         'url': 'http://www.goldenmoustache.com/suricate-le-poker-3700/',
15         'md5': '0f904432fa07da5054d6c8beb5efb51a',
16         'info_dict': {
17             'id': '3700',
18             'ext': 'mp4',
19             'title': 'Suricate - Le Poker',
20             'description': 'md5:3d1f242f44f8c8cb0a106f1fd08e5dc9',
21             'thumbnail': 're:^https?://.*\.jpg$',
22             'view_count': int,
23         }
24     }, {
25         'url': 'http://www.goldenmoustache.com/le-lab-tout-effacer-mc-fly-et-carlito-55249/',
26         'md5': '27f0c50fb4dd5f01dc9082fc67cd5700',
27         'info_dict': {
28             'id': '55249',
29             'ext': 'mp4',
30             'title': 'Le LAB - Tout Effacer (Mc Fly et Carlito)',
31             'description': 'md5:9b7fbf11023fb2250bd4b185e3de3b2a',
32             'thumbnail': 're:^https?://.*\.(?:png|jpg)$',
33             'view_count': int,
34         }
35     }]
36
37     def _real_extract(self, url):
38         video_id = self._match_id(url)
39         webpage = self._download_webpage(url, video_id)
40
41         video_url = self._html_search_regex(
42             r'data-src-type="mp4" data-src="([^"]+)"', webpage, 'video URL')
43         title = self._html_search_regex(
44             r'<title>(.*?)(?: - Golden Moustache)?</title>', webpage, 'title')
45         thumbnail = self._og_search_thumbnail(webpage)
46         description = self._og_search_description(webpage)
47         view_count = int_or_none(self._html_search_regex(
48             r'<strong>([0-9]+)</strong>\s*VUES</span>',
49             webpage, 'view count', fatal=False))
50
51         return {
52             'id': video_id,
53             'url': video_url,
54             'ext': 'mp4',
55             'title': title,
56             'description': description,
57             'thumbnail': thumbnail,
58             'view_count': view_count,
59         }