NotJoeMartinez / yt-fts

YouTube Full Text Search - Search all of a YouTube channel from the command line
The Unlicense
1.6k stars 80 forks source link

'NoneType' object has no attribute 'group' #150

Closed sharpsteelsoftware closed 2 months ago

sharpsteelsoftware commented 2 months ago

I get the following error when I try to yt-fts download URL

Traceback (most recent call last): File "/Users/joseph/.pyenv/versions/3.12.3/bin/yt-fts", line 8, in <module> sys.exit(cli()) ^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/yt_fts/yt_fts.py", line 52, in download channel_id = get_channel_id(url, s) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joseph/.pyenv/versions/3.12.3/lib/python3.12/site-packages/yt_fts/download.py", line 30, in get_channel_id channel_id = re.search('channelId":"(.{24})"', html).group(1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group'

NotJoeMartinez commented 2 months ago

@sharpsteelsoftware thanks for reporting this, the issue was cause by YouTube changing the html of channel pages. Just fixed in v0.1.51 by searching for <meta property="og:url" content="https://www.youtube.com/channel/UC3S8vxwRfqLBdIhgRlDRVzw"> in the HTML.