Skip to content

Commit

Permalink
Fix importing FreeTube subscriptions with multiple profiles
Browse files Browse the repository at this point in the history
Co-Authored-By: Samantaz Fox <coding@samantaz.fr>
  • Loading branch information
ChunkyProgrammer and SamantazFox committed Oct 16, 2023
1 parent 069e91d commit 0bd4151
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/invidious/user/imports.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0bd4151

Please sign in to comment.