+ age_limit = self._rta_search(webpage)
+
+ hd = is_hd(webpage)
+ video_url = extract_video_url(webpage)
+ formats = [{
+ 'url': video_url,
+ 'format_id': 'hd' if hd else 'sd',
+ 'preference': 0,
+ }]
+
+ video_mp4_url = extract_mp4_video_url(webpage)
+ if video_mp4_url is not None:
+ formats.append({
+ 'url': video_mp4_url,
+ 'ext': 'mp4',
+ 'format_id': 'mp4-hd' if hd else 'mp4-sd',
+ 'preference': 1,
+ })
+
+ if not hd:
+ webpage = self._download_webpage(
+ mrss_url + '?hd', video_id, note='Downloading HD webpage')
+ if is_hd(webpage):
+ video_url = extract_video_url(webpage)
+ formats.append({
+ 'url': video_url,
+ 'format_id': 'hd',
+ 'preference': 2,
+ })
+
+ self._sort_formats(formats)
+
+ return {
+ 'id': video_id,
+ 'title': video_title,
+ 'formats': formats,