]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/nate.py
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 id = self
._match
_id
(url
)
64 video_data
= self
._download
_json
(f
'https://tv.nate.com/api/v1/clip/{id}', 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 []]
71 self
._sort
_formats
(formats
)
74 'title': video_data
.get('clipTitle'),
75 'description': video_data
.get('synopsis'),
76 'thumbnail': video_data
.get('contentImg'),
77 'upload_date': unified_strdate(traverse_obj(video_data
, 'broadDate', 'regDate')),
78 'age_limit': video_data
.get('targetAge'),
79 'duration': video_data
.get('playTime'),
81 'uploader': video_data
.get('programTitle'),
82 'channel': video_data
.get('programTitle'),
83 'channel_id': str_or_none(video_data
.get('programSeq')),
84 'uploader_id': str_or_none(video_data
.get('programSeq')),
85 'tags': video_data
['hashTag'].split(',') if video_data
.get('hashTag') else None,
89 class NateProgramIE(InfoExtractor
):
90 _VALID_URL
= r
'https?://tv\.nate\.com/program/clips/(?P<id>[0-9]+)'
93 'url': 'https://tv.nate.com/program/clips/27987',
94 'playlist_mincount': 191,
99 'url': 'https://tv.nate.com/program/clips/3606',
100 'playlist_mincount': 15,
106 def _entries(self
, id):
107 for page_num
in itertools
.count(1):
108 program_data
= self
._download
_json
(f
'https://tv.nate.com/api/v1/program/{id}/clip/ranking?size=20&page={page_num}',
109 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 'https://tv.nate.com/clip/%s' % clip_id
,
115 ie
=NateIE
.ie_key(), video_id
=clip_id
)
116 if program_data
.get('last'):
119 def _real_extract(self
, url
):
120 id = self
._match
_id
(url
)
121 return self
.playlist_result(self
._entries
(id), playlist_id
=id)