1 from .common
import InfoExtractor
2 from ..utils
import clean_html
, int_or_none
, traverse_obj
4 _API_URL
= 'https://dak1vd5vmi7x6.cloudfront.net/api/v1/publicrole/{}/{}?id={}'
7 class ManotoTVIE(InfoExtractor
):
8 IE_DESC
= 'Manoto TV (Episode)'
9 _VALID_URL
= r
'https?://(?:www\.)?manototv\.com/episode/(?P<id>[0-9]+)'
11 'url': 'https://www.manototv.com/episode/8475',
14 'series': 'خانه های رویایی با برادران اسکات',
17 'episode_id': 'My Dream Home S7: Carol & John',
19 'categories': ['سرگرمی'],
20 'title': 'کارول و جان',
21 'description': 'md5:d0fff1f8ba5c6775d312a00165d1a97e',
22 'thumbnail': r
're:^https?://.*\.(jpeg|png|jpg)$',
26 'skip_download': 'm3u8',
29 'url': 'https://www.manototv.com/episode/12576',
32 'series': 'فیلم های ایرانی',
33 'episode_id': 'Seh Mah Taatili',
36 'categories': ['سرگرمی'],
37 'title': 'سه ماه تعطیلی',
38 'description': 'سه ماه تعطیلی فیلمی به کارگردانی و نویسندگی شاپور قریب ساختهٔ سال ۱۳۵۶ است.',
39 'thumbnail': r
're:^https?://.*\.(jpeg|png|jpg)$',
43 'skip_download': 'm3u8',
47 def _real_extract(self
, url
):
48 video_id
= self
._match
_id
(url
)
49 episode_json
= self
._download
_json
(_API_URL
.format('showmodule', 'episodedetails', video_id
), video_id
)
50 details
= episode_json
.get('details', {})
51 formats
= self
._extract
_m
3u8_formats
(details
.get('videoM3u8Url'), video_id
, 'mp4')
54 'series': details
.get('showTitle'),
55 'season_number': int_or_none(details
.get('analyticsSeasonNumber')),
56 'episode_number': int_or_none(details
.get('episodeNumber')),
57 'episode_id': details
.get('analyticsEpisodeTitle'),
58 'duration': int_or_none(details
.get('durationInMinutes'), invscale
=60),
59 'view_count': details
.get('viewCount'),
60 'categories': [details
.get('videoCategory')],
61 'title': details
.get('episodeTitle'),
62 'description': clean_html(details
.get('episodeDescription')),
63 'thumbnail': details
.get('episodelandscapeImgIxUrl'),
68 class ManotoTVShowIE(InfoExtractor
):
69 IE_DESC
= 'Manoto TV (Show)'
70 _VALID_URL
= r
'https?://(?:www\.)?manototv\.com/show/(?P<id>[0-9]+)'
72 'url': 'https://www.manototv.com/show/2526',
73 'playlist_mincount': 68,
76 'title': 'فیلم های ایرانی',
77 'description': 'مجموعه ای از فیلم های سینمای کلاسیک ایران',
81 def _real_extract(self
, url
):
82 show_id
= self
._match
_id
(url
)
83 show_json
= self
._download
_json
(_API_URL
.format('showmodule', 'details', show_id
), show_id
)
84 show_details
= show_json
.get('details', {})
85 title
= show_details
.get('showTitle')
86 description
= show_details
.get('showSynopsis')
88 series_json
= self
._download
_json
(_API_URL
.format('showmodule', 'serieslist', show_id
), show_id
)
89 playlist_id
= str(traverse_obj(series_json
, ('details', 'list', 0, 'id')))
91 playlist_json
= self
._download
_json
(_API_URL
.format('showmodule', 'episodelist', playlist_id
), playlist_id
)
92 playlist
= traverse_obj(playlist_json
, ('details', 'list')) or []
96 'https://www.manototv.com/episode/{}'.format(item
['slideID']), ie
=ManotoTVIE
.ie_key(), video_id
=item
['slideID'])
98 return self
.playlist_result(entries
, show_id
, title
, description
)
101 class ManotoTVLiveIE(InfoExtractor
):
102 IE_DESC
= 'Manoto TV (Live)'
103 _VALID_URL
= r
'https?://(?:www\.)?manototv\.com/live/'
105 'url': 'https://www.manototv.com/live/',
108 'title': 'Manoto TV Live',
113 'skip_download': 'm3u8',
117 def _real_extract(self
, url
):
119 json
= self
._download
_json
(_API_URL
.format('livemodule', 'details', ''), video_id
)
120 details
= json
.get('details', {})
121 video_url
= details
.get('liveUrl')
122 formats
= self
._extract
_m
3u8_formats
(video_url
, video_id
, 'mp4', live
=True)
125 'title': 'Manoto TV Live',