Skip to content

Commit 57353fe

Browse files
committed
Fix Freetube subscriptions import
1 parent 60e870b commit 57353fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/invidious/user/imports.cr

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ struct Invidious::User
152152
# -------------------
153153

154154
def from_freetube(user : User, body : String)
155+
# Legacy import?
155156
matches = body.scan(/"channelId":"(?<channel_id>[a-zA-Z0-9_-]{24})"/)
157+
subs = matches.map(&.["channel_id"])
156158

157-
user.subscriptions += matches.map(&.["channel_id"])
159+
if subs.empty?
160+
data = JSON.parse(body)["subscriptions"]
161+
subs = data.as_a.map(&.["id"].as_s)
162+
end
163+
164+
user.subscriptions += subs
158165
user.subscriptions.uniq!
159166
user.subscriptions = get_batch_channels(user.subscriptions)
160167

0 commit comments

Comments
 (0)