My Vision, Computer Vision

[오류 모음]youtube-dl, pytube, youtube.py(NotFoundError, like_count, OSError) 본문

환경 설정

[오류 모음]youtube-dl, pytube, youtube.py(NotFoundError, like_count, OSError)

gyuilLim 2024. 3. 25. 17:04

1. youtube-dl 패키지 오류

ModuleNotFoundError: No module named 'youtube_dl'

 

혹은

 

ImportError: pafy: youtube-dl not found; you can use the internal backend by setting the environmental variable PAFY_BACKEND to "internal". It is not enabled by default because it is not as well maintained as the youtube-dl backend.

 

와 같은 에러가 발생하면 아래 명령어를 터미널에 실행

pip install youtube-dl

 

끝!

2. KeyError: 'like_count'

youtube-dl을 설치하고 다시 실행했을 때 이 에러가 발생한다면

pip install youtube-dl==2020.12.2

 

위 명령어를 다시 터미널에 실행해주면 해결된다.

 

3. youtube-dl OSError

OSError: ERROR: Unable to extract uploader id; 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.

 

1. 이렇게 위와 같은 에러가 발생한다면, 에러 메시지에서 ctrl+F 로 youtube.py를 검색한다.

 

2. ctrl+왼쪽 마우스로 youtube.py 소스 파일로 이동해준다.

 

3. 소스 파일에서 ctrl+F로 'uploader_id': self._search_regex 부분을 검색한다.

 

4. 해당 라인을 주석 처리하고 밑의 코드를 바로 아래에 추가해준다.

'uploader_id': self._search_regex(r'/(?:channel/|user/|@)([^/?&#]+)', owner_profile_url, 'uploader id', default=None),

ctrl+S로 저장 후 창을 닫아준다. 끝!

728x90