diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr index 61d10719b..f8b9e4e40 100644 --- a/src/invidious/user/imports.cr +++ b/src/invidious/user/imports.cr @@ -152,9 +152,16 @@ struct Invidious::User # ------------------- def from_freetube(user : User, body : String) + # Legacy import? matches = body.scan(/"channelId":"(?[a-zA-Z0-9_-]{24})"/) + subs = matches.map(&.["channel_id"]) - user.subscriptions += matches.map(&.["channel_id"]) + if subs.empty? + data = JSON.parse(body)["subscriptions"] + subs = data.as_a.map(&.["id"].as_s) + end + + user.subscriptions += subs user.subscriptions.uniq! user.subscriptions = get_batch_channels(user.subscriptions)