]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/nate.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
15 class NateIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)'
19 'url': 'https://tv.nate.com/clip/1848976',
23 'title': '[결승 오프닝 타이틀] 2018 LCK 서머 스플릿 결승전 kt Rolster VS Griffin',
24 'description': 'md5:e1b79a7dcf0d8d586443f11366f50e6f',
25 'thumbnail': r
're:^https?://.*\.jpg',
26 'upload_date': '20180908',
29 'uploader': '2018 LCK 서머 스플릿(롤챔스)',
30 'channel': '2018 LCK 서머 스플릿(롤챔스)',
32 'uploader_id': '3606',
35 'params': {'skip_download': True}
37 'url': 'https://tv.nate.com/clip/4300566',
41 'title': '[심쿵엔딩] 이준호x이세영, 서로를 기억하며 끌어안는 두 사람!💕, MBC 211204 방송',
42 'description': 'md5:be1653502d9c13ce344ddf7828e089fa',
43 'thumbnail': r
're:^https?://.*\.jpg',
44 'upload_date': '20211204',
47 'uploader': '옷소매 붉은 끝동',
48 'channel': '옷소매 붉은 끝동',
49 'channel_id': '27987',
50 'uploader_id': '27987',
53 'params': {'skip_download': True}
65 def _real_extract(self
, url
):
66 id = self
._match
_id
(url
)
67 video_data
= self
._download
_json
(f
'https://tv.nate.com/api/v1/clip/{id}', id)
69 'format_id': f_url
[-2:],
71 'height': self
._QUALITY
.get(f_url
[-2:]),
72 'quality': int_or_none(f_url
[-2:]),
73 } for f_url
in video_data
.get('smcUriList') or []]
74 self
._sort
_formats
(formats
)
77 'title': video_data
.get('clipTitle'),
78 'description': video_data
.get('synopsis'),
79 'thumbnail': video_data
.get('contentImg'),
80 'upload_date': unified_strdate(traverse_obj(video_data
, 'broadDate', 'regDate')),
81 'age_limit': video_data
.get('targetAge'),
82 'duration': video_data
.get('playTime'),
84 'uploader': video_data
.get('programTitle'),
85 'channel': video_data
.get('programTitle'),
86 'channel_id': str_or_none(video_data
.get('programSeq')),
87 'uploader_id': str_or_none(video_data
.get('programSeq')),
88 'tags': video_data
['hashTag'].split(',') if video_data
.get('hashTag') else None,
92 class NateProgramIE(InfoExtractor
):
93 _VALID_URL
= r
'https?://tv\.nate\.com/program/clips/(?P<id>[0-9]+)'
96 'url': 'https://tv.nate.com/program/clips/27987',
97 'playlist_mincount': 191,
102 'url': 'https://tv.nate.com/program/clips/3606',
103 'playlist_mincount': 15,
109 def _entries(self
, id):
110 for page_num
in itertools
.count(1):
111 program_data
= self
._download
_json
(f
'https://tv.nate.com/api/v1/program/{id}/clip/ranking?size=20&page={page_num}',
112 id, note
=f
'Downloading page {page_num}')
113 for clip
in program_data
.get('content') or []:
114 clip_id
= clip
.get('clipSeq')
116 yield self
.url_result(
117 'https://tv.nate.com/clip/%s' % clip_id
,
118 ie
=NateIE
.ie_key(), video_id
=clip_id
)
119 if program_data
.get('last'):
122 def _real_extract(self
, url
):
123 id = self
._match
_id
(url
)
124 return self
.playlist_result(self
._entries
(id), playlist_id
=id)