在 youtubesearchpython 中构建频道链接时,出现了 TypeError: 'NoneType' for 'channel ID' (componenthandler.py)
作者: inspector3535创建于 2026年5月3日更新于 2026年5月3日
错误追踪:
Traceback (most recent call last):
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\mps_youtube\main.py", line 78, in matchfunction
func(*matches)
~~~~^^^^^^^^^^
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\mps_youtube\commands\search.py", line 310, in search
wdata = pafy.search_videos(term, int(config.PAGES.get))
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\mps_youtube\pafy.py", line 76, in search_videos
videosSearch.next()
~~~~~~~~~~~~~~~~~^^
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtubesearchpython\search.py", line 152, in next
return self._next()
~~~~~~~~~~^^
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtubesearchpython\core\search.py", line 94, in _next
self._getComponents(*self.searchMode)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtubesearchpython\core\search.py", line 114, in _getComponents
self.resultComponents.append(self._getVideoComponent(element))
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\sonay\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtubesearchpython\handlers\componenthandler.py", line 32, in _getVideoComponent
component['channel']['link'] = 'https://www.youtube.com/channel/' + component['channel']['id']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str内容来源: mps-youtube/yewtube