3 from .common
import InfoExtractor
12 class NateIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)'
16 'url': 'https://tv.nate.com/clip/1848976',
20 'title': '[결승 오프닝 타이틀] 2018 LCK 서머 스플릿 결승전 kt Rolster VS Griffin',
21 'description': 'md5:e1b79a7dcf0d8d586443f11366f50e6f',
22 'thumbnail': r
're:^https?://.*\.jpg',
23 'upload_date': '20180908',
26 'uploader': '2018 LCK 서머 스플릿(롤챔스)',
27 'channel': '2018 LCK 서머 스플릿(롤챔스)',
29 'uploader_id': '3606',
32 'params': {'skip_download': True},
34 'url': 'https://tv.nate.com/clip/4300566',
38 'title': '[심쿵엔딩] 이준호x이세영, 서로를 기억하며 끌어안는 두 사람!💕, MBC 211204 방송',
39 'description': 'md5:be1653502d9c13ce344ddf7828e089fa',
40 'thumbnail': r
're:^https?://.*\.jpg',
41 'upload_date': '20211204',
44 'uploader': '옷소매 붉은 끝동',
45 'channel': '옷소매 붉은 끝동',
46 'channel_id': '27987',
47 'uploader_id': '27987',
50 'params': {'skip_download': True},
62 def _real_extract(self
, url
):
63 video_id
= self
._match
_id
(url
)
64 video_data
= self
._download
_json
(f
'https://tv.nate.com/api/v1/clip/{video_id}', video_id
)
66 'format_id': f_url
[-2:],
68 'height': self
._QUALITY
.get(f_url
[-2:]),
69 'quality': int_or_none(f_url
[-2:]),
70 } for f_url
in video_data
.get('smcUriList') or []]
73 'title': video_data
.get('clipTitle'),
74 'description': video_data
.get('synopsis'),
75 'thumbnail': video_data
.get('contentImg'),
76 'upload_date': unified_strdate(traverse_obj(video_data
, 'broadDate', 'regDate')),
77 'age_limit': video_data
.get('targetAge'),
78 'duration': video_data
.get('playTime'),
80 'uploader': video_data
.get('programTitle'),
81 'channel': video_data
.get('programTitle'),
82 'channel_id': str_or_none(video_data
.get('programSeq')),
83 'uploader_id': str_or_none(video_data
.get('programSeq')),
84 'tags': video_data
['hashTag'].split(',') if video_data
.get('hashTag') else None,
88 class NateProgramIE(InfoExtractor
):
89 _VALID_URL
= r
'https?://tv\.nate\.com/program/clips/(?P<id>[0-9]+)'
92 'url': 'https://tv.nate.com/program/clips/27987',
93 'playlist_mincount': 191,
98 'url': 'https://tv.nate.com/program/clips/3606',
99 'playlist_mincount': 15,
105 def _entries(self
, playlist_id
):
106 for page_num
in itertools
.count(1):
107 program_data
= self
._download
_json
(
108 f
'https://tv.nate.com/api/v1/program/{playlist_id}/clip/ranking?size=20&page={page_num}',
109 playlist_id
, note
=f
'Downloading page {page_num}')
110 for clip
in program_data
.get('content') or []:
111 clip_id
= clip
.get('clipSeq')
113 yield self
.url_result(
114 f
'https://tv.nate.com/clip/{clip_id}', NateIE
, playlist_id
)
115 if program_data
.get('last'):
118 def _real_extract(self
, url
):
119 playlist_id
= self
._match
_id
(url
)
120 return self
.playlist_result(self
._entries
(playlist_id
), playlist_id
=playlist_id
)