This commit is contained in:
hyeeji 2021-12-07 03:11:01 +09:00
parent a803582717
commit 2b0623b116
2 changed files with 52 additions and 0 deletions

View file

@ -721,6 +721,8 @@ from .nationalgeographic import (
NationalGeographicVideoIE,
NationalGeographicTVIE,
)
from .nate import NateIE
from .naver import NaverIE
from .nba import (
NBAWatchEmbedIE,

View file

@ -0,0 +1,50 @@
# 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',
'age_limit' : '15'
# 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)
webpage = self._download_webpage(url, video_id)
#video_data = self._download_json(
# 'https://tv.nate.com/api/v1/clip/% s'%video_id, video_id, headers=self.geo_verification_headers())
video_data = self._download_json(url, video_id)
title = video_data.get('clipTitle')
thumbnail = video_data.get('contentImg')
upload_date = video_data.get('regData')
age_limit = video_data.get('targetAge')
# TODO more code goes here, for example ...
return {
'id': video_id,
'title': title,
'thumbnail' : thumbnail,
'upload_date' : upload_date[:8],
'age_limit' : age_limit
# TODO more properties (see youtube_dl/extractor/common.py)
}