2021-12-07 03:11:01 +09:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
class NateIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:m\.)?tv\.nate\.com/clip/(?P<id>[0-9]+)'
|
|
|
|
_API_BASE_TMPL = 'https://tv.nate.com/api/v1/clip/%s'
|
|
|
|
_TEST = {
|
|
|
|
'url': 'https://tv.nate.com/clip/4300566',
|
|
|
|
#'md5': '02D3CAB3907B60C58043761F8B5BF2B3',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '4300566',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': '[심쿵엔딩] 이준호x이세영, 서로를 기억하며 끌어안는 두 사람!💕, MBC 211204 방송',
|
|
|
|
'thumbnail': r're:^http?://.*\.jpg$',
|
|
|
|
'upload_date': '20211204',
|
2021-12-07 13:18:15 +09:00
|
|
|
'age_limit' : 15
|
2021-12-07 03:11:01 +09:00
|
|
|
# TODO more properties, either as:
|
|
|
|
# * A value
|
|
|
|
# * MD5 checksum; start the string with md5:
|
|
|
|
# * A regular expression; start the string with re:
|
|
|
|
# * Any Python type (for example int or float)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
2021-12-07 19:09:23 +09:00
|
|
|
|
2021-12-07 13:18:15 +09:00
|
|
|
video_data = self._download_json('https://tv.nate.com/api/v1/clip/' + str(video_id), video_id)
|
2021-12-07 03:11:01 +09:00
|
|
|
|
|
|
|
title = video_data.get('clipTitle')
|
|
|
|
thumbnail = video_data.get('contentImg')
|
2021-12-07 13:18:15 +09:00
|
|
|
upload_date = video_data.get('regDate')
|
2021-12-07 03:11:01 +09:00
|
|
|
age_limit = video_data.get('targetAge')
|
2021-12-07 13:18:15 +09:00
|
|
|
url = video_data['smcUriList'][4]
|
2021-12-07 03:11:01 +09:00
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'thumbnail' : thumbnail,
|
|
|
|
'upload_date' : upload_date[:8],
|
2021-12-07 13:18:15 +09:00
|
|
|
'age_limit' : age_limit,
|
|
|
|
'url': url
|
2021-12-07 03:11:01 +09:00
|
|
|
}
|