From 99884f28be0dbec1df30a61b5234eeee1d2ee384 Mon Sep 17 00:00:00 2001 From: joyfuI Date: Sun, 15 Nov 2020 14:41:36 +0900 Subject: [PATCH 1/4] =?UTF-8?q?README.md=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 39d2dc5..e57b2d3 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로 과연 이걸로 뭔가를 만드실 분이 계실지... [youtube-dl](https://github.com/ytdl-org/youtube-dl)의 DMCA 테이크다운 이후, 업데이트 속도가 느려진 것 같아서 youtube-dl의 포크 프로젝트인 [youtube-dlc](https://github.com/blackjack4494/yt-dlc)를 추가했습니다. -설정에서 취향껏 설정해서 사용하시면 됩니다. +설정에서 취향껏 골라서 사용하시면 됩니다. ## API ### 공통사항 @@ -53,7 +53,7 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로 `errorCode` | 에러 코드 | Integer `info_dict` | 동영상 정보 | Object -동영상 정보(`info_dict` 키)에는 youtube-dl에서 생성한 info_dict 정보가 그대로 들어있습니다. 따라서 이 부분은 직접 주소를 넣어가며 반환되는 정보를 확인해보는게 좋습니다. +동영상 정보(`info_dict` 키)에는 youtube-dl에서 생성한 info_dict 정보가 그대로 들어있습니다. 따라서 이 부분은 직접 주소를 넣어가며 반환되는 정보를 확인해보는 게 좋습니다. 간단한 예로 `thumbnail` 키엔 썸네일 주소, `uploader` 키엔 업로더 이름, `title` 키엔 동영상 제목, `duration` 키엔 동영상 길이 등이 들어 있습니다. 그리고 만약 주소가 플레이리스트라면 `_type` 키에 `"playlist"`라는 값이 들어 있습니다. 이때는 `entries` 키에 리스트가 들어있어 동영상들의 제목과 ID를 확인할 수 있습니다. @@ -72,7 +72,7 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로 `preferredcodec` | 추출할 오디오 코덱. 가능한 값은 `"best"`, `"mp3"`, `"aac"`, `"flac"`, `"m4a"`, `"opus"`, `"vorbis"`, `"wav"`. 미지정 시 추출하지 않음 | X | String `preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `192` | X | Integer `dateafter` | 지정한 날짜 이후에 업로드된 동영상만 다운로드. 미지정 시 모든 동영상 다운로드 | X | String -`archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있을 경우 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String +`archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있으면 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean `dateafter` 키에 넣을 수 있는 날짜는 `YYYYMMDD` 또는 `(now|today)[+-][0-9](day|week|month|year)(s)?` 형식의 문자열입니다. @@ -218,7 +218,7 @@ v1.3.1 v1.3.0 * 후처리 기능 추가 이제 비디오 변환이나 오디오 추출이 가능합니다. - 오디오 추출의 경우 비트레이트는 192kbps로 설정되어 있습니다. + 오디오 추출의 비트레이트는 192kbps로 설정되어 있습니다. v1.2.5 * 기본 파일명 설정 추가 From a7ee24d43628252ef26fa6319a85ee1f1d4b850e Mon Sep 17 00:00:00 2001 From: joyfuI Date: Fri, 20 Nov 2020 20:47:48 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EB=A7=81=ED=81=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- templates/youtube-dl_download.html | 4 ++-- templates/youtube-dl_setting.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e57b2d3..2a4a880 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,9 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로 `plugin` | 플러그인 이름 | O | String `key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String `url` | 동영상 주소 | O | String -`filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고. 미지정 시 사용자 설정 | X | String +`filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/#output-template 참고. 미지정 시 사용자 설정 | X | String `save_path` | 저장 폴더 경로. 미지정 시 사용자 설정 | X | String -`format` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고. 미지정 시 최고 화질 | X | String +`format` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/#format-selection 참고. 미지정 시 최고 화질 | X | String `preferedformat` | 변환할 비디오 포맷. 가능한 포맷은 https://ffmpeg.org/general.html#File-Formats 참고. 미지정 시 변환하지 않음 | X | String `preferredcodec` | 추출할 오디오 코덱. 가능한 값은 `"best"`, `"mp3"`, `"aac"`, `"flac"`, `"m4a"`, `"opus"`, `"vorbis"`, `"wav"`. 미지정 시 추출하지 않음 | X | String `preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `192` | X | Integer diff --git a/templates/youtube-dl_download.html b/templates/youtube-dl_download.html index 2c6542d..c192cfd 100644 --- a/templates/youtube-dl_download.html +++ b/templates/youtube-dl_download.html @@ -33,9 +33,9 @@
{{ macros.setting_input_text('url', 'URL', placeholder='http:// 주소', desc='유튜브, 네이버TV 등 동영상 주소') }} - {{ macros.setting_input_text('filename', '파일명', value=arg['filename'], desc='템플릿 규칙은 https://github.com/blackjack4494/yt-dlc#output-template 참고') }} + {{ macros.setting_input_text('filename', '파일명', value=arg['filename'], desc='템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/#output-template 참고') }} {{ macros.setting_select('preset', '동영상 포맷 프리셋', arg['preset_list'], col='3') }} - {{ macros.setting_input_text('format', '동영상 포맷', desc=['포맷 지정은 https://github.com/blackjack4494/yt-dlc#format-selection 참고', '빈칸으로 두면 최고 화질로 다운로드합니다.']) }} + {{ macros.setting_input_text('format', '동영상 포맷', desc=['포맷 지정은 https://github.com/ytdl-org/youtube-dl/#format-selection 참고', '빈칸으로 두면 최고 화질로 다운로드합니다.']) }} {{ setting_select2('postprocessor', '후처리', arg['postprocessor_list'], col='3', desc='다운로드 후 FFmpeg로 후처리합니다.') }} {{ macros.setting_button([['download_btn', '다운로드']]) }}
diff --git a/templates/youtube-dl_setting.html b/templates/youtube-dl_setting.html index a6d28cd..b819341 100644 --- a/templates/youtube-dl_setting.html +++ b/templates/youtube-dl_setting.html @@ -8,7 +8,7 @@ {{ macros.setting_input_text_and_buttons('ffmpeg_path', 'FFmpeg 경로', [['ffmpeg_version', '버전확인']], value=arg['ffmpeg_path'], placeholder='ffmpeg', desc='SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다.') }} {{ macros.setting_input_text('temp_path', '임시 폴더', value=arg['temp_path'], desc='다운로드 파일이 임시로 저장될 폴더입니다.') }} {{ macros.setting_input_text('save_path', '저장 폴더', value=arg['save_path'], desc='정상적으로 완료된 파일이 이동할 폴더입니다.') }} - {{ macros.setting_input_text('default_filename', '기본 파일명', value=arg['default_filename'], placeholder=arg['DEFAULT_FILENAME'], desc='템플릿 규칙은 https://github.com/blackjack4494/yt-dlc#output-template 참고') }} + {{ macros.setting_input_text('default_filename', '기본 파일명', value=arg['default_filename'], placeholder=arg['DEFAULT_FILENAME'], desc='템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/#output-template 참고') }} {{ macros.setting_input_text('proxy', '프록시', value=arg['proxy'], desc=['HTTP/HTTPS/SOCKS를 지원합니다. 예) socks5://127.0.0.1:1080/', '빈칸으로 두면 프록시를 사용하지 않습니다.']) }} {{ macros.setting_checkbox('activate_cors', 'CORS 허용', value=arg['activate_cors'], desc='API로의 크로스 도메인 요청을 허용합니다. 설정 저장 후 재시작이 필요합니다.') }} {{ macros.setting_button([['global_setting_save_btn', '저장']]) }} From 33bfe6f4ee51a9b66b1b902ac70706903258c7ee Mon Sep 17 00:00:00 2001 From: soju6jan Date: Mon, 7 Dec 2020 15:07:05 +0900 Subject: [PATCH 3/4] =?UTF-8?q?API=EB=A1=9C=20headers,=20cookiefile=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=20=EB=B0=A9=EB=B2=95=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * API로 headers, cookiefile 전달 방법 추가 * API로 headers, cookiefile 전달 방법 추가 Co-authored-by: joyfuI --- logic_normal.py | 4 +++- my_youtube_dl.py | 18 ++++++++++++++---- plugin.py | 13 ++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/logic_normal.py b/logic_normal.py index cd20bb5..3782ab2 100644 --- a/logic_normal.py +++ b/logic_normal.py @@ -111,7 +111,9 @@ class LogicNormal(object): if 'ffmpeg_path' in kwagrs and kwagrs['ffmpeg_path']: opts['ffmpeg_location'] = kwagrs['ffmpeg_path'] dateafter = kwagrs.get('dateafter') - youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter) + # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 + youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter, headers=kwagrs['headers'], cookiefile=kwagrs['cookiefile']) + # by soju6jan youtube_dl.key = kwagrs.get('key') LogicNormal.youtube_dl_list.append(youtube_dl) # 리스트 추가 return youtube_dl diff --git a/my_youtube_dl.py b/my_youtube_dl.py index fc56cfb..07d4652 100644 --- a/my_youtube_dl.py +++ b/my_youtube_dl.py @@ -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): + def __init__(self, plugin, url, filename, temp_path, save_path=None, opts=None, dateafter=None, datebefore=None, headers=None, cookiefile=None): # from youtube_dl.utils import DateRange from .plugin import YOUTUBE_DL_PACKAGE DateRange = __import__('%s.utils' % YOUTUBE_DL_PACKAGE, fromlist=['DateRange']).DateRange @@ -92,6 +92,9 @@ class MyYoutubeDL(object): 'eta': None, # 예상 시간(s) 'speed': None # 다운로드 속도(bytes/s) } + # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 + self.headers = headers + self.cookiefile = cookiefile def start(self): if self.status != Status.READY: @@ -109,8 +112,12 @@ class MyYoutubeDL(object): try: self.start_time = datetime.now() self.status = Status.START + # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 + # headers는 전역으로 계속 사용하기 때문에 매번 세팅. + youtube_dl_utils = __import__('%s.utils' % YOUTUBE_DL_PACKAGE) + youtube_dl_utils.std_headers = {} if self.headers is None else self.headers # 동영상 정보 가져오기 - info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy')) + info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy'), cookiefile=self.cookiefile) if info_dict is None: self.status = Status.ERROR return @@ -126,6 +133,8 @@ class MyYoutubeDL(object): 'ignoreerrors': True, 'cachedir': False } + if self.cookiefile: + ydl_opts['cookiefile'] = self.cookiefile ydl_opts.update(self.opts) with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([self.url]) @@ -164,11 +173,10 @@ class MyYoutubeDL(object): return __version__ @staticmethod - def get_info_dict(url, proxy=None): + def get_info_dict(url, proxy=None, cookiefile=None): # import youtube_dl from .plugin import YOUTUBE_DL_PACKAGE youtube_dl = __import__('%s' % YOUTUBE_DL_PACKAGE) - try: ydl_opts = { 'simulate': True, @@ -178,6 +186,8 @@ class MyYoutubeDL(object): } if proxy: ydl_opts['proxy'] = proxy + if cookiefile: + ydl_opts['cookiefile'] = cookiefile with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url]) except Exception as e: diff --git a/plugin.py b/plugin.py index 41392c2..cf5e3b5 100644 --- a/plugin.py +++ b/plugin.py @@ -209,6 +209,14 @@ def api(sub): dateafter = request.values.get('dateafter', None) archive = request.values.get('archive', None) start = request.values.get('start', False) + # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 + headers = None + tmp_headers = request.values.get('headers', None) + if tmp_headers is not None: + import json + headers = json.loads(tmp_headers) # header는 json.dumps로 넘어오는 것으로 함. unqoute 등을 해야하는지 고려해야함. + cookiefile = request.values.get('cookiefile', None) + # by soju6jan ret = { 'errorCode': 0, 'index': None @@ -234,7 +242,10 @@ def api(sub): archive=archive, proxy=ModelSetting.get('proxy'), ffmpeg_path=ModelSetting.get('ffmpeg_path'), - key=key) + key=key, + # 2020-12-06 by soju6jan. + headers=headers, + cookiefile=cookiefile) if youtube_dl is None: return LogicNormal.abort(ret, 10) # 실패 ret['index'] = youtube_dl.index From 04937f7c64652ba3c1ecc29a920d6563f8f6786c Mon Sep 17 00:00:00 2001 From: joyfuI Date: Mon, 7 Dec 2020 23:59:36 +0900 Subject: [PATCH 4/4] =?UTF-8?q?download=20API=EC=97=90=20cookiefile,=20hea?= =?UTF-8?q?ders=20=ED=82=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit download API에 cookiefile, headers 키 추가 (Thanks to soju6jan) --- README.md | 10 +++++++++- info.json | 2 +- logic_normal.py | 7 ++++--- my_youtube_dl.py | 16 +++++----------- plugin.py | 17 ++++++----------- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 2a4a880..89c89e1 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,11 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로 `dateafter` | 지정한 날짜 이후에 업로드된 동영상만 다운로드. 미지정 시 모든 동영상 다운로드 | X | String `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)?` 형식의 문자열입니다. +`dateafter` 키에 넣을 수 있는 날짜는 `YYYYMMDD` 또는 `(now|today)[+-][0-9](day|week|month|year)(s)?` 형식의 문자열입니다. +`headers` 키에 넣는 값은 `json` 형식의 문자열입니다. #### Response 키 | 설명 | 타입 --- | --- | --- @@ -132,6 +135,11 @@ API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로 물론 해당 정보가 없으면 null입니다. ## Changelog +v2.1.0 +* download API에 cookiefile, headers 키 추가 + 카카오TV 동영상 다운로드에 활용할 수 있습니다. 잘하면 로봇 체크 패스에도 사용이 가능한 듯 싶습니다. + Thanks to [soju6jan](https://github.com/soju6jan) + v2.0.0 * youtube-dlc 추가 사용할 youtube-dl 패키지를 선택할 수 있습니다. 설정 변경 후 재시작해야 적용됩니다. diff --git a/info.json b/info.json index 21833e4..fa542f4 100644 --- a/info.json +++ b/info.json @@ -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.0.0", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} \ No newline at end of file +{"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.0", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} \ No newline at end of file diff --git a/logic_normal.py b/logic_normal.py index 3782ab2..6483768 100644 --- a/logic_normal.py +++ b/logic_normal.py @@ -110,10 +110,11 @@ class LogicNormal(object): opts['proxy'] = kwagrs['proxy'] if 'ffmpeg_path' in kwagrs and kwagrs['ffmpeg_path']: opts['ffmpeg_location'] = kwagrs['ffmpeg_path'] + if 'cookiefile' in kwagrs and kwagrs['cookiefile']: + opts['cookiefile'] = kwagrs['cookiefile'] dateafter = kwagrs.get('dateafter') - # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 - youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter, headers=kwagrs['headers'], cookiefile=kwagrs['cookiefile']) - # by soju6jan + headers = kwagrs.get('headers') + youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter, headers) youtube_dl.key = kwagrs.get('key') LogicNormal.youtube_dl_list.append(youtube_dl) # 리스트 추가 return youtube_dl diff --git a/my_youtube_dl.py b/my_youtube_dl.py index 07d4652..4f230e4 100644 --- a/my_youtube_dl.py +++ b/my_youtube_dl.py @@ -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=None, cookiefile=None): + def __init__(self, plugin, url, filename, temp_path, save_path=None, opts=None, dateafter=None, datebefore=None, headers={}): # from youtube_dl.utils import DateRange from .plugin import YOUTUBE_DL_PACKAGE DateRange = __import__('%s.utils' % YOUTUBE_DL_PACKAGE, fromlist=['DateRange']).DateRange @@ -66,6 +66,7 @@ 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 @@ -92,9 +93,6 @@ class MyYoutubeDL(object): 'eta': None, # 예상 시간(s) 'speed': None # 다운로드 속도(bytes/s) } - # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 - self.headers = headers - self.cookiefile = cookiefile def start(self): if self.status != Status.READY: @@ -112,12 +110,10 @@ class MyYoutubeDL(object): try: self.start_time = datetime.now() self.status = Status.START - # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 - # headers는 전역으로 계속 사용하기 때문에 매번 세팅. - youtube_dl_utils = __import__('%s.utils' % YOUTUBE_DL_PACKAGE) - youtube_dl_utils.std_headers = {} if self.headers is None else self.headers + # headers는 전역으로 계속 사용하기 때문에 매번 세팅 + youtube_dl.utils.std_headers = self.headers # 동영상 정보 가져오기 - info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy'), cookiefile=self.cookiefile) + info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy'), self.opts.get('cookiefile')) if info_dict is None: self.status = Status.ERROR return @@ -133,8 +129,6 @@ class MyYoutubeDL(object): 'ignoreerrors': True, 'cachedir': False } - if self.cookiefile: - ydl_opts['cookiefile'] = self.cookiefile ydl_opts.update(self.opts) with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([self.url]) diff --git a/plugin.py b/plugin.py index cf5e3b5..8124958 100644 --- a/plugin.py +++ b/plugin.py @@ -5,6 +5,7 @@ import os import sys import traceback import subprocess +import json # third-party from flask import Blueprint, request, render_template, redirect, jsonify, abort @@ -44,7 +45,7 @@ menu = { } plugin_info = { - 'version': '2.0.0', + 'version': '2.1.0', 'name': 'youtube-dl', 'category_name': 'vod', 'developer': 'joyfuI', @@ -209,14 +210,8 @@ def api(sub): dateafter = request.values.get('dateafter', None) archive = request.values.get('archive', None) start = request.values.get('start', False) - # 2020-12-06 by soju6jan. api로 headers, cookiefile 전달 - headers = None - tmp_headers = request.values.get('headers', None) - if tmp_headers is not None: - import json - headers = json.loads(tmp_headers) # header는 json.dumps로 넘어오는 것으로 함. unqoute 등을 해야하는지 고려해야함. cookiefile = request.values.get('cookiefile', None) - # by soju6jan + headers = request.values.get('headers', '{}') ret = { 'errorCode': 0, 'index': None @@ -243,9 +238,9 @@ def api(sub): proxy=ModelSetting.get('proxy'), ffmpeg_path=ModelSetting.get('ffmpeg_path'), key=key, - # 2020-12-06 by soju6jan. - headers=headers, - cookiefile=cookiefile) + cookiefile=cookiefile, + # header는 json.dumps로 넘어오는 것으로 함. unqoute 등을 해야하는지 고려해야 함 + headers=json.loads(headers)) if youtube_dl is None: return LogicNormal.abort(ret, 10) # 실패 ret['index'] = youtube_dl.index