diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr
index 48bf769f..a006d602 100644
--- a/src/invidious/helpers/utils.cr
+++ b/src/invidious/helpers/utils.cr
@@ -440,7 +440,7 @@ def parse_link_endpoint(endpoint : JSON::Any, text : String, video_id : String)
# - https://github.com/iv-org/invidious/issues/3062
text = %(#{text})
else
- text = %(#{reduce_uri(url)})
+ text = %(#{reduce_uri(text)})
end
end
return text
diff --git a/src/invidious/jobs.cr b/src/invidious/jobs.cr
index 524a3624..b6b673f7 100644
--- a/src/invidious/jobs.cr
+++ b/src/invidious/jobs.cr
@@ -2,7 +2,7 @@ module Invidious::Jobs
JOBS = [] of BaseJob
# Automatically generate a structure that wraps the various
- # jobs' configs, so that the follwing YAML config can be used:
+ # jobs' configs, so that the following YAML config can be used:
#
# jobs:
# job_name:
diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr
index e4b25156..0a2fe1e2 100644
--- a/src/invidious/user/imports.cr
+++ b/src/invidious/user/imports.cr
@@ -6,7 +6,7 @@ struct Invidious::User
# Parse a youtube CSV subscription file
def parse_subscription_export_csv(csv_content : String)
- rows = CSV.new(csv_content, headers: true)
+ rows = CSV.new(csv_content.strip('\n'), headers: true)
subscriptions = Array(String).new
# Counter to limit the amount of imports.
@@ -32,10 +32,10 @@ struct Invidious::User
def parse_playlist_export_csv(user : User, raw_input : String)
# Split the input into head and body content
- raw_head, raw_body = raw_input.split("\n\n", limit: 2, remove_empty: true)
+ raw_head, raw_body = raw_input.strip('\n').split("\n\n", limit: 2, remove_empty: true)
# Create the playlist from the head content
- csv_head = CSV.new(raw_head, headers: true)
+ csv_head = CSV.new(raw_head.strip('\n'), headers: true)
csv_head.next
title = csv_head[4]
description = csv_head[5]
@@ -51,7 +51,7 @@ struct Invidious::User
Invidious::Database::Playlists.update_description(playlist.id, description)
# Add each video to the playlist from the body content
- csv_body = CSV.new(raw_body, headers: true)
+ csv_body = CSV.new(raw_body.strip('\n'), headers: true)
csv_body.each do |row|
video_id = row[0]
if playlist
diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr
index 2e8eecc3..9cc0ffdc 100644
--- a/src/invidious/videos/parser.cr
+++ b/src/invidious/videos/parser.cr
@@ -78,7 +78,11 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)
elsif video_id != player_response.dig("videoDetails", "videoId")
# YouTube may return a different video player response than expected.
# See: https://github.com/TeamNewPipe/NewPipe/issues/8713
- raise VideoNotAvailableException.new("The video returned by YouTube isn't the requested one. (WEB client)")
+ # Line to be reverted if one day we solve the video not available issue.
+ return {
+ "version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64),
+ "reason" => JSON::Any.new("Can't load the video on this Invidious instance. YouTube is currently trying to block Invidious instances. Click here for more info about the issue."),
+ }
else
reason = nil
end