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': 'f79b009c66194acacd40712a6778acfa',
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']
50 video_urls = video.get('video_files', [])
51 video_file = video.get('video_file')
53 video_urls.append(video_file)
54 video_urls = list(set(video_urls))
56 video_prefix = video_urls[0].rsplit('/', 1)[0]
58 for flv_file in video.get('flv_files', []):
59 flv_url = '%s/%s' % (video_prefix, flv_file)
60 if flv_url not in video_urls:
61 video_urls.append(flv_url)
63 filesh = video.get('filesh')
65 self.video_url_to_format(video_url, filesh)
66 for video_url in video_urls]
67 self._sort_formats(formats)
69 timestamp = video.get('date')
71 # upload date is in CEST
72 timestamp = parse_iso8601(timestamp + ' +0200', ' ')
75 'url': self._proto_relative_url(thumbnail)
76 } for thumbnail in video.get('thumbnails', [])]
78 tags = [tag['title'] for tag in video.get('tags') or []]
81 'id': video.get('id') or video_id,
83 'description': video.get('description'),
84 'thumbnails': thumbnails,
85 'uploader': video.get('user_name'),
86 'uploader_id': video.get('user_id'),
87 'timestamp': timestamp,
88 'duration': int_or_none(video.get('length')),
89 'age_limit': parse_age_limit(video.get('age_limit')),
94 def video_url_to_format(self, video_url, filesh):
95 height = int_or_none(self._search_regex(
96 r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None))
98 token = filesh.get(compat_str(height))
100 video_url = update_url_query(video_url, {'token': token})
107 class IndavideoIE(InfoExtractor):
108 _VALID_URL = r'https?://(?:.+?\.)?indavideo\.hu/video/(?P<id>[^/#?]+)'
110 'url': 'http://indavideo.hu/video/Vicces_cica_1',
111 'md5': '8c82244ba85d2a2310275b318eb51eac',
114 'display_id': 'Vicces_cica_1',
116 'title': 'Vicces cica',
117 'description': 'Játszik a tablettel. :D',
118 'thumbnail': r're:^https?://.*\.jpg$',
119 'uploader': 'Jet_Pack',
120 'uploader_id': '491217',
121 'timestamp': 1390821212,
122 'upload_date': '20140127',
125 'tags': ['vicces', 'macska', 'cica', 'ügyes', 'nevetés', 'játszik', 'Cukiság', 'Jet_Pack'],
128 'url': 'http://index.indavideo.hu/video/2015_0728_beregszasz',
129 'only_matching': True,
131 'url': 'http://auto.indavideo.hu/video/Sajat_utanfutoban_a_kis_tacsko',
132 'only_matching': True,
134 'url': 'http://erotika.indavideo.hu/video/Amator_tini_punci',
135 'only_matching': True,
137 'url': 'http://film.indavideo.hu/video/f_hrom_nagymamm_volt',
138 'only_matching': True,
140 'url': 'http://palyazat.indavideo.hu/video/Embertelen_dal_Dodgem_egyuttes',
141 'only_matching': True,
144 def _real_extract(self, url):
145 display_id = self._match_id(url)
147 webpage = self._download_webpage(url, display_id)
148 embed_url = self._search_regex(
149 r'<link[^>]+rel="video_src"[^>]+href="(.+?)"', webpage, 'embed url')
152 '_type': 'url_transparent',
153 'ie_key': 'IndavideoEmbed',
155 'display_id': display_id,