From 0bd415158f44c2411bc04cd01ff606e15c3c7d2a Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Wed, 26 Jul 2023 18:53:29 -0700 Subject: [PATCH] Fix importing FreeTube subscriptions with multiple profiles Co-Authored-By: Samantaz Fox --- src/invidious/user/imports.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr index 86d0ce6e..0d21bc44 100644 --- a/src/invidious/user/imports.cr +++ b/src/invidious/user/imports.cr @@ -228,8 +228,12 @@ struct Invidious::User subs = matches.map(&.["channel_id"]) if subs.empty? - data = JSON.parse(body)["subscriptions"] - subs = data.as_a.map(&.["id"].as_s) + profiles = body.split('\n', remove_empty: true) + profiles.each do |profile| + if data = JSON.parse(profile)["subscriptions"]? + subs += data.as_a.map(&.["id"].as_s) + end + end end user.subscriptions += subs