diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-05-03 22:39:02 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-05-03 22:39:02 -0500 |
| commit | b52803904c8c590c8148be0cc60b11758eddc688 (patch) | |
| tree | 832a9dcf02ff65a3a41385304b09eb06339c9c01 /src/helpers.cr | |
| parent | d1841b9be584dbd66148f77a3cb752a24a7e7ba3 (diff) | |
| download | invidious-b52803904c8c590c8148be0cc60b11758eddc688.tar.gz invidious-b52803904c8c590c8148be0cc60b11758eddc688.tar.bz2 invidious-b52803904c8c590c8148be0cc60b11758eddc688.zip | |
Add fix for channels that have been deleted
Diffstat (limited to 'src/helpers.cr')
| -rw-r--r-- | src/helpers.cr | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/helpers.cr b/src/helpers.cr index 4d725e19..315ffa59 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -585,7 +585,8 @@ def fetch_channel(id, client, db) ON CONFLICT (id) DO NOTHING", video_array) end - author = rss.xpath_node("//feed/author/name").not_nil!.content + author = rss.xpath_node("//feed/author/name").try &.content + author ||= "" channel = InvidiousChannel.new(id, author, Time.now) @@ -623,7 +624,7 @@ def fetch_user(sid, client, headers) channels = [] of String feed.xpath_nodes(%q(//ul[@id="guide-channels"]/li/a)).each do |channel| if !["Popular on YouTube", "Music", "Sports", "Gaming"].includes? channel["title"] - channel_id = channel["href"].lstrip("/channel/").not_nil! + channel_id = channel["href"].lstrip("/channel/") get_channel(channel_id, client, PG_DB) channels << channel_id |
