From 7d6bc671c2691be6d5f8d7fdbde2e3339b5f3937 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 5 Aug 2018 14:46:21 -0500 Subject: [PATCH] Fix searches where items don't have byline --- src/invidious/search.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/invidious/search.cr b/src/invidious/search.cr index 6b6d3f57..1b1afbfb 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -35,7 +35,10 @@ def search(query, page = 1, search_params = build_search_params(content_type: "v title = anchor.content.strip video_id = anchor["href"].lchop("/watch?v=") - anchor = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-byline")]/a)).not_nil! + anchor = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-byline")]/a)) + if !anchor + next + end author = anchor.content author_url = anchor["href"] ucid = author_url.split("/")[-1]