v1.6.3 프록시 기능을 사용해도 국가차단 우회가 안 되는 문제 수정

This commit is contained in:
joyfuI
2020-07-09 23:59:38 +09:00
parent 6bedf69533
commit ecb4ed12b1
4 changed files with 10 additions and 5 deletions

View File

@@ -131,6 +131,9 @@ API에선 직접 비트레이트를 설정할 수 있습니다.
물론 해당 정보가 없으면 null입니다. 물론 해당 정보가 없으면 null입니다.
## Changelog ## Changelog
v1.6.3
* 프록시 기능을 사용해도 국가차단 우회가 안 되는 문제 수정
v1.6.2 v1.6.2
v1.6.1 v1.6.1

View File

@@ -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": "1.6.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": "1.6.3", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"}

View File

@@ -96,7 +96,7 @@ class Youtube_dl(object):
try: try:
self.start_time = datetime.now() self.start_time = datetime.now()
self.status = Status.START self.status = Status.START
info_dict = Youtube_dl.get_info_dict(self.url) # 동영상 정보 가져오기 info_dict = Youtube_dl.get_info_dict(self.url, self.opts.get('proxy')) # 동영상 정보 가져오기
if info_dict is None: # 가져오기 실패 if info_dict is None: # 가져오기 실패
self.status = Status.ERROR self.status = Status.ERROR
return return
@@ -146,7 +146,7 @@ class Youtube_dl(object):
return youtube_dl.version.__version__ return youtube_dl.version.__version__
@staticmethod @staticmethod
def get_info_dict(url): def get_info_dict(url, proxy=None):
import youtube_dl import youtube_dl
try: try:
ydl_opts = { ydl_opts = {
@@ -155,6 +155,8 @@ class Youtube_dl(object):
'extract_flat': 'in_playlist', 'extract_flat': 'in_playlist',
'logger': MyLogger() 'logger': MyLogger()
} }
if proxy:
ydl_opts['proxy'] = proxy
with youtube_dl.YoutubeDL(ydl_opts) as ydl: with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url]) ydl.download([url])
except Exception as e: except Exception as e:

View File

@@ -34,7 +34,7 @@ menu = {
} }
plugin_info = { plugin_info = {
'version': '1.6.2', 'version': '1.6.3',
'name': 'youtube-dl', 'name': 'youtube-dl',
'category_name': 'vod', 'category_name': 'vod',
'developer': 'joyfuI', 'developer': 'joyfuI',
@@ -170,7 +170,7 @@ def api(sub):
return LogicNormal.abort(ret, 1) # 필수 요청 변수가 없음 return LogicNormal.abort(ret, 1) # 필수 요청 변수가 없음
if not url.startswith('http'): if not url.startswith('http'):
return LogicNormal.abort(ret, 2) # 잘못된 동영상 주소 return LogicNormal.abort(ret, 2) # 잘못된 동영상 주소
info_dict = Youtube_dl.get_info_dict(url) info_dict = Youtube_dl.get_info_dict(url, ModelSetting.get('proxy'))
if info_dict is None: if info_dict is None:
return LogicNormal.abort(ret, 10) # 실패 return LogicNormal.abort(ret, 10) # 실패
ret['info_dict'] = info_dict ret['info_dict'] = info_dict