2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_str
14 class IndavideoEmbedIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu/swf/player\.swf\?.*\b(?:v(?:ID|id))=)(?P<id>[\da-f]+)'
17 'url': 'http://indavideo.hu/player/video/1bdc3c6d80/',
18 'md5': 'c8a507a1c7410685f83a06eaeeaafeab',
24 'thumbnail': r're:^https?://.*\.jpg$',
25 'uploader': 'cukiajanlo',
26 'uploader_id': '83729',
27 'timestamp': 1439193826,
28 'upload_date': '20150810',
31 'tags': ['tánc', 'cica', 'cuki', 'cukiajanlo', 'newsroom'],
34 'url': 'http://embed.indavideo.hu/player/video/1bdc3c6d80?autostart=1&hide=1',
35 'only_matching': True,
37 'url': 'http://assets.indavideo.hu/swf/player.swf?v=fe25e500&vID=1bdc3c6d80&autostart=1&hide=1&i=1',
38 'only_matching': True,
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
44 video = self._download_json(
45 'http://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/%s' % video_id,
48 title = video['title']
52 video_files = video.get('video_files')
53 if isinstance(video_files, list):
54 video_urls.extend(video_files)
55 elif isinstance(video_files, dict):
56 video_urls.extend(video_files.values())
58 video_file = video.get('video_file')
60 video_urls.append(video_file)
61 video_urls = list(set(video_urls))
63 video_prefix = video_urls[0].rsplit('/', 1)[0]
65 for flv_file in video.get('flv_files', []):
66 flv_url = '%s/%s' % (video_prefix, flv_file)
67 if flv_url not in video_urls:
68 video_urls.append(flv_url)
70 filesh = video.get('filesh')
73 for video_url in video_urls:
74 height = int_or_none(self._search_regex(
75 r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None))
79 token = filesh.get(compat_str(height))
82 video_url = update_url_query(video_url, {'token': token})
87 self._sort_formats(formats)
89 timestamp = video.get('date')
91 # upload date is in CEST
92 timestamp = parse_iso8601(timestamp + ' +0200', ' ')
95 'url': self._proto_relative_url(thumbnail)
96 } for thumbnail in video.get('thumbnails', [])]
98 tags = [tag['title'] for tag in video.get('tags') or []]
101 'id': video.get('id') or video_id,
103 'description': video.get('description'),
104 'thumbnails': thumbnails,
105 'uploader': video.get('user_name'),
106 'uploader_id': video.get('user_id'),
107 'timestamp': timestamp,
108 'duration': int_or_none(video.get('length')),
109 'age_limit': parse_age_limit(video.get('age_limit')),
115 class IndavideoIE(InfoExtractor):
116 _VALID_URL = r'https?://(?:.+?\.)?indavideo\.hu/video/(?P<id>[^/#?]+)'
118 'url': 'http://indavideo.hu/video/Vicces_cica_1',
119 'md5': '8c82244ba85d2a2310275b318eb51eac',
122 'display_id': 'Vicces_cica_1',
124 'title': 'Vicces cica',
125 'description': 'Játszik a tablettel. :D',
126 'thumbnail': r're:^https?://.*\.jpg$',
127 'uploader': 'Jet_Pack',
128 'uploader_id': '491217',
129 'timestamp': 1390821212,
130 'upload_date': '20140127',
136 'url': 'http://index.indavideo.hu/video/2015_0728_beregszasz',
137 'only_matching': True,
139 'url': 'http://auto.indavideo.hu/video/Sajat_utanfutoban_a_kis_tacsko',
140 'only_matching': True,
142 'url': 'http://erotika.indavideo.hu/video/Amator_tini_punci',
143 'only_matching': True,
145 'url': 'http://film.indavideo.hu/video/f_hrom_nagymamm_volt',
146 'only_matching': True,
148 'url': 'http://palyazat.indavideo.hu/video/Embertelen_dal_Dodgem_egyuttes',
149 'only_matching': True,
152 def _real_extract(self, url):
153 display_id = self._match_id(url)
155 webpage = self._download_webpage(url, display_id)
156 embed_url = self._search_regex(
157 (r'<iframe[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//embed\.indavideo\.hu/player/video/.+?)\1',
158 r'<link[^>]+rel="video_src"[^>]+href="(?P<url>.+?)"'),
159 webpage, 'embed url', group='url')
162 '_type': 'url_transparent',
163 'ie_key': 'IndavideoEmbed',
165 'display_id': display_id,