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

@@ -96,7 +96,7 @@ class Youtube_dl(object):
try:
self.start_time = datetime.now()
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: # 가져오기 실패
self.status = Status.ERROR
return
@@ -146,7 +146,7 @@ class Youtube_dl(object):
return youtube_dl.version.__version__
@staticmethod
def get_info_dict(url):
def get_info_dict(url, proxy=None):
import youtube_dl
try:
ydl_opts = {
@@ -155,6 +155,8 @@ class Youtube_dl(object):
'extract_flat': 'in_playlist',
'logger': MyLogger()
}
if proxy:
ydl_opts['proxy'] = proxy
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
except Exception as e: