download API의 headers 키 제거
This commit is contained in:
@@ -75,10 +75,8 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로
|
||||
`archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있으면 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String
|
||||
`start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean
|
||||
`cookiefile` | 다운로드 시 필요한 쿠키 파일 경로 | X | String
|
||||
`headers` | 다운로드 시 사용할 헤더. 기본값: `{}` | X | String
|
||||
|
||||
`dateafter` 키에 넣을 수 있는 날짜는 `YYYYMMDD` 또는 `(now|today)[+-][0-9](day|week|month|year)(s)?` 형식의 문자열입니다.
|
||||
`headers` 키에 넣는 값은 `json` 형식의 문자열입니다.
|
||||
#### Response
|
||||
키 | 설명 | 타입
|
||||
--- | --- | ---
|
||||
@@ -135,6 +133,9 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로
|
||||
물론 해당 정보가 없으면 null입니다.
|
||||
|
||||
## Changelog
|
||||
v2.2.0
|
||||
* download API의 headers 키 제거
|
||||
|
||||
v2.1.2
|
||||
* youtube-dlc 호환 문제 수정
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "2.1.2", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"}
|
||||
{"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "2.2.0", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"}
|
||||
@@ -113,8 +113,7 @@ class LogicNormal(object):
|
||||
if 'cookiefile' in kwagrs and kwagrs['cookiefile']:
|
||||
opts['cookiefile'] = kwagrs['cookiefile']
|
||||
dateafter = kwagrs.get('dateafter')
|
||||
headers = kwagrs.get('headers', {})
|
||||
youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter, headers=headers)
|
||||
youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter)
|
||||
youtube_dl.key = kwagrs.get('key')
|
||||
LogicNormal.youtube_dl_list.append(youtube_dl) # 리스트 추가
|
||||
return youtube_dl
|
||||
|
||||
@@ -45,7 +45,7 @@ class MyYoutubeDL(object):
|
||||
__index = 0
|
||||
_last_msg = ''
|
||||
|
||||
def __init__(self, plugin, url, filename, temp_path, save_path=None, opts=None, dateafter=None, datebefore=None, headers={}):
|
||||
def __init__(self, plugin, url, filename, temp_path, save_path=None, opts=None, dateafter=None, datebefore=None):
|
||||
# from youtube_dl.utils import DateRange
|
||||
from .plugin import YOUTUBE_DL_PACKAGE
|
||||
DateRange = __import__('%s.utils' % YOUTUBE_DL_PACKAGE, fromlist=['DateRange']).DateRange
|
||||
@@ -66,7 +66,6 @@ class MyYoutubeDL(object):
|
||||
self.opts = opts
|
||||
if dateafter or datebefore:
|
||||
self.opts['daterange'] = DateRange(start=dateafter, end=datebefore)
|
||||
self.headers = headers
|
||||
self.index = MyYoutubeDL.__index
|
||||
MyYoutubeDL.__index += 1
|
||||
self.__status = Status.READY
|
||||
@@ -110,8 +109,6 @@ class MyYoutubeDL(object):
|
||||
try:
|
||||
self.start_time = datetime.now()
|
||||
self.status = Status.START
|
||||
# headers는 전역으로 계속 사용하기 때문에 매번 세팅
|
||||
youtube_dl.utils.std_headers = self.headers
|
||||
# 동영상 정보 가져오기
|
||||
info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy'), self.opts.get('cookiefile'))
|
||||
if info_dict is None:
|
||||
|
||||
@@ -45,7 +45,7 @@ menu = {
|
||||
}
|
||||
|
||||
plugin_info = {
|
||||
'version': '2.1.2',
|
||||
'version': '2.2.0',
|
||||
'name': 'youtube-dl',
|
||||
'category_name': 'vod',
|
||||
'developer': 'joyfuI',
|
||||
@@ -211,7 +211,6 @@ def api(sub):
|
||||
archive = request.values.get('archive', None)
|
||||
start = request.values.get('start', False)
|
||||
cookiefile = request.values.get('cookiefile', None)
|
||||
headers = request.values.get('headers', '{}')
|
||||
ret = {
|
||||
'errorCode': 0,
|
||||
'index': None
|
||||
@@ -238,9 +237,7 @@ def api(sub):
|
||||
proxy=ModelSetting.get('proxy'),
|
||||
ffmpeg_path=ModelSetting.get('ffmpeg_path'),
|
||||
key=key,
|
||||
cookiefile=cookiefile,
|
||||
# header는 json.dumps로 넘어오는 것으로 함. unqoute 등을 해야하는지 고려해야 함
|
||||
headers=json.loads(headers))
|
||||
cookiefile=cookiefile)
|
||||
if youtube_dl is None:
|
||||
return LogicNormal.abort(ret, 10) # 실패
|
||||
ret['index'] = youtube_dl.index
|
||||
|
||||
Reference in New Issue
Block a user