diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-11-15 09:38:29 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-11-15 09:38:29 -0600 |
| commit | 6db235becfb10baf9f2624b8ccd375fda8cc7216 (patch) | |
| tree | 49982c7a48f8cc3d7dee4572e6f8c6ea9a9d6ce6 | |
| parent | 71303452d883d3dfd66020b832ac33a2fc93c34e (diff) | |
| download | invidious-6db235becfb10baf9f2624b8ccd375fda8cc7216.tar.gz invidious-6db235becfb10baf9f2624b8ccd375fda8cc7216.tar.bz2 invidious-6db235becfb10baf9f2624b8ccd375fda8cc7216.zip | |
Remove nil assertions from video extractor
| -rw-r--r-- | src/invidious/videos.cr | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 64e817dd..14b19142 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -677,7 +677,8 @@ def fetch_video(id, proxies) wilson_score = ci_lower_bound(likes, likes + dislikes) - published = html.xpath_node(%q(//meta[@itemprop="datePublished"])).not_nil!["content"] + published = html.xpath_node(%q(//meta[@itemprop="datePublished"])).try &.["content"] + published ||= Time.now.to_s("%Y-%m-%d") published = Time.parse(published, "%Y-%m-%d", Time::Location.local) allowed_regions = html.xpath_node(%q(//meta[@itemprop="regionsAllowed"])).try &.["content"].split(",") @@ -685,7 +686,9 @@ def fetch_video(id, proxies) is_family_friendly = html.xpath_node(%q(//meta[@itemprop="isFamilyFriendly"])).try &.["content"] == "True" is_family_friendly ||= true - genre = html.xpath_node(%q(//meta[@itemprop="genre"])).not_nil!["content"] + genre = html.xpath_node(%q(//meta[@itemprop="genre"])).try &.["content"] + genre ||= "" + genre_url = html.xpath_node(%(//a[text()="#{genre}"])).try &.["href"] case genre when "Movies" |
