Microsoft MVP성태의 닷넷 이야기
youtube-dl을 파이썬으로 실행하는 방법 [링크 복사], [링크+제목 복사],
조회: 4080
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

youtube-dl을 파이썬으로 실행하는 방법

오랜만에 실행했더니 오류가 발생하는군요. ^^

c:\temp\youtube-dl> youtube-dl.exe -F ...[생략]...
[youtube] ...: Downloading webpage
[youtube] ...: Downloading player 6f20102c
ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

재미있는 건, youtube-dl.exe가 있는 c:\temp 디렉터리가 아닌, 다른 곳에서 PATH를 연결해 실행하면 아예 Windows Defender에 의해 오류가 발생한다는 점입니다.

C:\temp2> youtube-dl
Access is denied.

This app can't run on your PC
To find a version for your PC, check with the software publisher.

지난번에는 업데이트해서 해결(1, 2)했는데, 이번에는 저게 최신 버전이었고 해결이 안 됩니다. ^^;




그런데, github에 가보면,

ytdl-org/youtube-dl
; https://github.com/ytdl-org/youtube-dl/issues

딱히 이에 관한 이슈가 없습니다. 음... 저만 문제 있는 걸까요? ^^ 암튼, 문제가 있으니 일단 youtube-dl.exe는 포기하고 github에 있는 소스코드를 직접 다운로드해 실행해 볼까 하는데요,

c:\temp> git clone https://github.com/ytdl-org/youtube-dl.git

일단, 파이썬으로 해보면 실행은 되는데 찝찝한 경고 하나가 남습니다.

c:\temp\youtube-dl> python -m youtube_dl -F [...영상_id...]
[youtube] ...: Downloading webpage
[youtube] ...: Downloading player 6f20102c
WARNING: [youtube] Unable to decode n-parameter: download likely to be throttled (Unhandled exception in decode; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):
  File "E:\git_clone\youtube-dl\youtube_dl\extractor\youtube.py", line 1672, in _n_descramble
    raise ExtractorError('Unhandled exception in decode')
youtube_dl.utils.ExtractorError: Unhandled exception in decode; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
)
[info] Available formats for ...:
format code  extension  resolution note
249          webm       audio only tiny   54k , webm_dash container, opus  (48000Hz), 1.56MiB
250          webm       audio only tiny   71k , webm_dash container, opus  (48000Hz), 2.06MiB
140          m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2 (44100Hz), 3.72MiB
251          webm       audio only tiny  138k , webm_dash container, opus  (48000Hz), 3.97MiB
278          webm       256x144    144p   23k , webm_dash container, vp9, 30fps, video only, 704.15KiB
160          mp4        256x144    144p   27k , mp4_dash container, avc1.4d400c, 30fps, video only, 803.63KiB
242          webm       426x240    240p   28k , webm_dash container, vp9, 30fps, video only, 825.20KiB
133          mp4        426x240    240p   49k , mp4_dash container, avc1.4d4015, 30fps, video only, 1.42MiB
243          webm       640x360    360p   39k , webm_dash container, vp9, 30fps, video only, 1.15MiB
134          mp4        640x360    360p   87k , mp4_dash container, avc1.4d401e, 30fps, video only, 2.51MiB
18           mp4        640x360    360p  215k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz) (best)

상관없습니다. 일단, 포맷은 구했으니 어쨌든 다운로드만 된다면 ^^ 우린 모든 걸 용서할 수 있습니다. 다행히 ^^ 아래와 같이 다운로드도 잘됩니다. ^^

c:\temp\youtube-dl> python -m youtube_dl [...영상_id...] -f 140
[youtube] ...: Downloading webpage
WARNING: [youtube] Unable to decode n-parameter: download likely to be throttled (Unhandled exception in decode; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):
  File "E:\git_clone\youtube-dl\youtube_dl\extractor\youtube.py", line 1672, in _n_descramble
    raise ExtractorError('Unhandled exception in decode')
youtube_dl.utils.ExtractorError: Unhandled exception in decode; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
)
[dashsegments] Total fragments: 1
[download] Destination: [...생략...].m4a
[download] 100% of 3.72MiB in 01:19
WARNING: ...: writing DASH m4a. Only some players support this container. Install ffmpeg or avconv to fix this automatically.

위의 경우는 오디오만 받았기 때문에 마지막에 경고가 나왔는데요, 괜찮습니다. 요즘 m4a 재생 못하는 프로그램이 없기 때문인데, 뭣하면 ffmpeg를 이용해 그냥 mp3로 바꿔도 됩니다. ^^

c:\temp> ffmpeg -i [...생략...].m4a [...생략...].mp3

// 시간 제어: 8초 전의 내용 삭제
c:\temp> ffmpeg -ss 8 -i [...생략...].m4a [...생략...].mp3

언제까지 youtube-dl이 안정적으로 실행될지는 알 수 없으나, 일단 ^^ 오늘은 여기까지만.









[최초 등록일: ]
[최종 수정일: 5/31/2023]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  [2]  3  4  5  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
527정성태7/13/20215667Microsoft Edge의 뉴스 알림 창 끄는 방법
526정성태7/11/202111380AMD CPU를 장착한 컴퓨터에서 Windows 11을 위한 fTPM 활성화 방법
525정성태6/30/20219568저작권 표시 없는 상업적 사용 가능한 무료 아이콘 구하기 [3]
524정성태6/25/20218553Windows 11 설치를 가로막는 TPM 칩, 운이 좋다면 구매할 수 있습니다. [3]
523정성태5/3/202110058절전 모드로 내려가는 우분투 머신 [7]
522정성태9/16/2020108582020년 작업 PC ^^ [7]
521정성태11/25/201910962[종료] "시작하세요. C# 8.0 프로그래밍" 책을 1만원에 판매합니다. (4권 한정) [2]
520정성태8/26/20197549Snagit 2019(Build 3847) 사용 시 Effect 변경 후 창을 닫는 시점에 응용 프로그램이 종료하는 현상
519정성태7/15/20199712youtube-dl.exe를 윈도우 샌드 박스에서 실행
518정성태7/1/201910450크로미움 기반의 Microsoft Edge 웹 브라우저... 쓸만하네요. ^^ [4]
517정성태5/16/20199563윈도 운영체제는 태생적으로 갖고 있는 문제들로 인해 아직도 매우 취약한 운영체제로 분류됩니다?!! [2]
516정성태5/16/20198549배터리 사용 중인 태블릿에는 크롬보다는 Edge 브라우저가 더 낫습니다.
515정성태11/19/201812908LED 전등 교체와 잔광 현상 제거 콘덴서 - 두 번째 이야기
514정성태10/30/201814538LED 매입등 교체와 잔광 현상 제거 콘덴서
513정성태9/13/20189891블로거 분들 랜섬웨어 메일 "저작권관련 이미지 무단사용 안내메일(장명옥 본인제작)" 조심하세요. [2]
512정성태8/10/20189657번개는 땅에서부터 하늘로 올라가는 현상? [1]
511정성태7/21/201810019[종료] DDR 3 4GB * 4EA, AMD 페넘II-X4 905e, 메인 보드 GA-770TA-UD3를 드립니다. [3]
509정성태6/12/201811451목/허리가 아픈 개발자들을 위한 근육 마사지 치료법 - KSNS [1]
508정성태5/22/201814899로이 베나비데스
507정성태4/13/201810927sysnet 블로그 관련 수치 [1]
506정성태1/20/201817007삼성 A/S 경험 - 오디세이(Odyssey) 노트북이 게임 도중 갑자기 전원이 나가는 경우 [2]
505정성태1/9/201716127모니터 간단 소개 - LG IPS LED 24MA53, 델 UltraSharp 24 - U2414H, 알파스캔 AOC 2477 IPS
504정성태9/25/201621402모니터 3대를 NVidia Surround로 연결하기 - 두 번째 [3]
503정성태9/22/201615682Wacom BAMBOO 태블릿 - Tablet PC Defined 메뉴가 없는 경우 [1]
501정성태5/31/201615692twoomail.com으로부터 온 "'...'님이 쪽지를 보냈습니다."는 twoo.com의 스팸 메일입니다.
499정성태2/16/2016177502016년 작업 PC ^^ [2]
1  [2]  3  4  5  6  7  8  9  10  11  12  13  14  15  ...