Microsoft MVP성태의 닷넷 이야기
youtube-dl을 파이썬으로 실행하는 방법 [링크 복사], [링크+제목 복사]
조회: 4061
글쓴 사람
정성태 (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

비밀번호

댓글 작성자
 




... 16  17  [18]  19 
NoWriterDateCnt.TitleFile(s)
87정성태7/10/200610187머리 좀 식히시지요. 파일 다운로드1
86정성태7/4/200610835검색 엔진에서의 "정성태"
84정성태6/20/200610821Is it wrong to Love Microsoft?
81정성태5/21/200610482S-ATA II 300GB 하드 디스크 장착. ^^
78정성태5/5/200610678Introduction to Programming LEGO MINDSTORMS
76정성태4/9/200611473DevDays 2006 행사에서... [4]
75정성태3/29/200611031노트북 메모리 2GB로 업그레이드 [1]
80정성태5/18/200611744    답변글 Insufficient System Resources Exist to Complete the API
74정성태3/25/200612328재미있는 로그들.
73정성태3/27/200610638This Page Is Valid XHTML 1.0 Transitional!
71정성태3/16/200611571영어 공부 열심히. [1]
70정성태3/13/200610629MSDN Magazine 2006년 2월호의 표지에 실린 멋진 코드. ^^ [1]
69정성태3/10/200610784휴대폰 컬러링 변경. ^^v - "난 나직이 그의 이름을 불러 보았어"
68정성태3/2/200611840우리집 무선 Access Point - GN-B49G
67정성태3/1/200610220지금은 서울역... ^^
66정성태2/27/200610193MS, 윈도 XP용 웹 콘텐츠 필터링 SW 개발
63정성태2/12/200610323서비스 불안정 [2]
61정성태2/4/200611701새로나온 calc.exe
60정성태2/4/200610397FW: 멋진 시도 그리고 멋진 작품
59정성태1/26/20069976질문은 이렇게 해주십시오.
54정성태12/3/20059844블로그의 출처...
53정성태11/20/200510343내 모든 토픽의 꼬리말로 달고 싶은 말
51정성태11/5/20059875저는... 모든 사람들이... [1]
48정성태10/19/200510046VSTS 와 함께 나온 "개발자 송" - .NETXPERT 5명 참가. ^^; [2]
47정성태10/10/200510162(일기는 아니지만) MSDN Magazine 같이 공부하실 분... 2차 모집합니다. ^^ [8]
46정성태11/14/200510418사진 2장.^^ [1]
... 16  17  [18]  19