Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- 알고리즘
- 파이썬
- 리눅스
- 딥러닝
- 도커
- deepstream
- 네트워크
- 딥스트림
- Linux
- nfs mount
- mAP@.5
- dkms
- 백준
- C
- tao_toolkit
- docker
- IOU
- 비디오미리보기
- Spring
- nouveau
- 스프링
- 도커 컨테이너
- 타오툴킷
- Python
- pyMySQL
- 주피터 노트북
- 정처기
- yolov7
- C++
- SQLD
Archives
- Today
- Total
한 번만 더 해보자
[Python] youtube-dl: Unable to extract uploader id / KeyError: 'like_count' 본문
언어/Python
[Python] youtube-dl: Unable to extract uploader id / KeyError: 'like_count'
정 하임 2023. 2. 28. 19:40상황
pafy를 이용해서 유튜브를 재생하려 했는데 에러가 발생했다
원인
코드가 업데이트 되어서 수정해야한다
Unable to extract uploader id
Traceback (most recent call last):
File "C:\\Users\\yolov7\\detect.py", line 199, in
detect()
File "C:\\Users\\yolov7\\detect.py", line 57, in detect
dataset = LoadStreams(source, img_size=imgsz, stride=stride)
File "C:\\Users\\yolov7\\utils\\datasets.py", line 288, in __init__
url = pafy.new(url).getbest(preftype="mp4").url
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\pafy.py", line 124, in new
return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\backend_youtube_dl.py", line 31, in __init__
super(YtdlPafy, self).__init__(*args, **kwargs)
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\backend_shared.py", line 97, in __init__
self._fetch_basic()
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\backend_youtube_dl.py", line 43, in _fetch_basic
raise IOError(str(e).replace('YouTube said', 'Youtube says'))
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.
/yt_dlp/extractor/youtube.py
/youtube_dl/extractor/youtube.py
파일 두 개 모두 수정해야 한다
# 'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,
'uploader_id': self._search_regex(r'/(?:channel/|user/|(?=@))([^/?&#]+)', owner_profile_url, 'uploader id', default=None),
수정했는데도 KeyError: 'like_count' 에러가 발생해서 또 코드 수정했다
KeyError: 'like_count'
1/1: <https://www.youtube.com/watch?v=dOp0oWFHUWw>... Traceback (most recent call last):
File "C:\\Users\\yolov7\\detect.py", line 199, in
detect()
File "C:\\Users\\yolov7\\detect.py", line 57, in detect
dataset = LoadStreams(source, img_size=imgsz, stride=stride)
File "C:\\Users\\yolov7\\utils\\datasets.py", line 288, in __init__
url = pafy.new(url).getbest(preftype="mp4").url
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\pafy.py", line 124, in new
return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\backend_youtube_dl.py", line 31, in __init__
super(YtdlPafy, self).__init__(*args, **kwargs)
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\backend_shared.py", line 97, in __init__
self._fetch_basic()
File "C:\\Users\\anaconda3\\envs\\ve\\lib\\site-packages\\pafy\\backend_youtube_dl.py", line 53, in _fetch_basic
self._likes = self._ydl_info['like_count']
KeyError: 'like_count'
/pafy/backend_youtube.py 코드 수정
# self._likes = self._ydl_info['like_count']
# self._dislikes = self._ydl_info['dislike_count']
self._likes = self._ydl_info.get('like_count',0)
self._dislikes = self._ydl_info.get('dislike_count',0)반응형
'언어 > Python' 카테고리의 다른 글
| [Python] Expected indented blockPylance (0) | 2024.01.04 |
|---|---|
| [Python] corrupt image/label: could not convert string to float: '\ufeff0’ (0) | 2024.01.04 |
| [Python] cv2 경로의 한글 깨짐 (0) | 2023.09.22 |
| [Python] cv2.error: OpenCV(4.7.0) error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. (0) | 2023.02.28 |
| [Python] 네이버 뉴스 크롤링 (0) | 2023.02.26 |