Microsoft MVP성태의 닷넷 이야기
youtube-dl을 파이썬으로 실행하는 방법 [링크 복사], [링크+제목 복사],
조회: 4084
글쓴 사람
정성태 (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)
473정성태1/14/201415308Google+ Hangouts 대신 예전의 구글톡(Google Talk)을 사용하고 싶다면? [1]
472정성태1/11/201424656Wacom BAMBOO 태블릿 - 우 클릭이 안되거나 좌표가 어긋나는 문제 [5]
471정성태1/9/201418655우와~~~ 2014년 새로운 PC를 장만했습니다. ^^ [2]
470정성태1/9/201419584Wacom BAMBOO 태블릿 - 클릭이 더블 클릭으로 처리되는 문제
469정성태1/2/201418064ATI - DVI에서 HDMI 케이블로 바꿨는데 화면 축소 현상
467정성태1/1/201418821개발자 여러분들에게 추천하는 상품 - 책상용 팔걸이 레스트보드(RESTBOARD) [4]
466정성태11/27/201320405제니퍼소프트는... [3]
464정성태11/5/201315276사파리 웹 브라우저의 메모리 leak 현상 [4]
463정성태10/31/201314827Adobe Reader로 PDF 파일 저장할 때 CPU 100%치는 현상
462정성태10/30/201318321우와~~~ 성태가 책을 썼습니다. ^^ [9]
461정성태9/19/201313812TED 강연 - Marla Spivak: Why bees are disappearing
460정성태8/14/201320085PC의 시간이 맞지 않는 경우, CMOS 배터리 교체 [2]
459정성태8/11/201315250TED 강연 - 에이미 커디(Amy Cuddy): 당신의 신체 언어가 자신의 모습을 결정한다.
458정성태5/11/201315363생각의 전환: 1. 개인 인공위성을 만든 미디어 아티스트 송호준 [3]
457정성태4/1/201317894삼성 노트북 - 고성능 전원 옵션에서 액정 화면이 어두운 경우
456정성태3/11/201317081재미있는 수학 문제 하나: x = y 일때 2 = 1 ? [3]파일 다운로드1
455정성태3/7/201318680윈도우 서버 2012에서 플래시가 동작하지 않는 경우
454정성태1/23/201314946네이버의 애드포스트 수익이 해피빈으로도 전환된다는 사실! 아시나요? [2]
453정성태1/23/201325505윈도우 8/2012 업데이트 후 Windows.old 폴더 삭제하는 배치 명령어 [6]
452정성태1/21/201325783시스템 트레이에 블루투스 아이콘 나오게 하는 방법 [1]
451정성태1/16/201314812세상을 바꾸는 노력 - 정치후원금
450정성태12/31/201215499유연한 개발자의 2013년 새해 인사 [7]
449정성태12/21/201222381새로운 노트북 - 삼성 센스 NT700Z5C-S88 크로노스 [2]
448정성태12/14/201218743유튜브(Youtube) 비디오 파일을 안전하게 다운로드 받는 방법 [1]
447정성태12/14/2012141454분짜리 Ad-Movie 입니다.
446정성태10/28/201233231오피스 2013 한글 버전 설치
1  2  3  [4]  5  6  7  8  9  10  11  12  13  14  15  ...