[youtube] Skip unsupported adaptive stream type (#18804)
[youtube-dl] / youtube_dl / extractor / yourporn.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import urljoin
5
6
7 class YourPornIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?yourporn\.sexy/post/(?P<id>[^/?#&.]+)'
9     _TEST = {
10         'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html',
11         'md5': '6f8682b6464033d87acaa7a8ff0c092e',
12         'info_dict': {
13             'id': '57ffcb2e1179b',
14             'ext': 'mp4',
15             'title': 'md5:c9f43630bd968267672651ba905a7d35',
16             'thumbnail': r're:^https?://.*\.jpg$',
17             'age_limit': 18
18         },
19     }
20
21     def _real_extract(self, url):
22         video_id = self._match_id(url)
23
24         webpage = self._download_webpage(url, video_id)
25
26         video_url = urljoin(url, self._parse_json(
27             self._search_regex(
28                 r'data-vnfo=(["\'])(?P<data>{.+?})\1', webpage, 'data info',
29                 group='data'),
30             video_id)[video_id]).replace('/cdn/', '/cdn3/')
31
32         title = (self._search_regex(
33             r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title',
34             default=None) or self._og_search_description(webpage)).strip()
35         thumbnail = self._og_search_thumbnail(webpage)
36
37         return {
38             'id': video_id,
39             'url': video_url,
40             'title': title,
41             'thumbnail': thumbnail,
42             'age_limit': 18
43         }