woefe / ytcc

Command line tool to keep track of your favorite playlists on YouTube and many other places.
GNU General Public License v3.0
179 stars 20 forks source link

feedparser error #41

Closed JoshuaFern closed 4 years ago

JoshuaFern commented 4 years ago

Recently started having a problem running ytcc on NixOS Unstable, here's the error:

nixos-workstation% ytcc
Updating channels...
Traceback (most recent call last):
  File "/nix/store/7cvik4jvdj7h1wm049ssh157616yirip-python3.8-feedparser-5.2.1/lib/python3.8/site-packages/feedparser.py", line 398, in __getattr__
    return self.__getitem__(key)
  File "/nix/store/7cvik4jvdj7h1wm049ssh157616yirip-python3.8-feedparser-5.2.1/lib/python3.8/site-packages/feedparser.py", line 356, in __getitem__
    return dict.__getitem__(self, key)
KeyError: 'published_parsed'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/bin/.ytcc-wrapped", line 5, in <module>
    main()
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/cli.py", line 617, in main
    run()
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/cli.py", line 596, in run
    update_all()
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/cli.py", line 384, in update_all
    ytcc_core.update_all()
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/core.py", line 161, in update_all
    self.database.add_videos(videos)
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/database.py", line 121, in add_videos
    for video in videos:
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator
    yield fs.pop().result()
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/core.py", line 140, in _update_channel
    return [
  File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/core.py", line 146, in <listcomp>
    publish_date=time.mktime(entry.published_parsed),
  File "/nix/store/7cvik4jvdj7h1wm049ssh157616yirip-python3.8-feedparser-5.2.1/lib/python3.8/site-packages/feedparser.py", line 400, in __getattr__
    raise AttributeError("object has no attribute '%s'" % key)
AttributeError: object has no attribute 'published_parsed'
nixos-workstation% ytcc -v
ytcc version 1.8.4

Copyright (C) 2015-2019  Wolfgang Popp
This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU General
Public Licence for details.
nixos-workstation% uname -a
Linux nixos-workstation 5.7.16 #1-NixOS SMP Wed Aug 19 06:24:20 UTC 2020 x86_64 GNU/Linux
JoshuaFern commented 4 years ago

This error seems to come and go, I posted this issue 2 hours ago and it's now working again. I've done no reboots or updates.

I've also had this happen once before, I encountered this error and it disappeared awhile later.

zoidby commented 4 years ago

I am getting the same error.

woefe commented 4 years ago

It seems that YouTube has rolled out an update, that sometimes breaks RSS feeds of some channels. I tried checking a feed manually and it indeed returned a feed without <updated> or <published> elements sometimes.

I'll implement a workaround that uses the current system time, if a feed entry does not have a <published> nor <updated> element

woefe commented 4 years ago

Fixed in v1.8.5