mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Fix Freetube subscriptions import
This commit is contained in:
parent
60e870b277
commit
57353fe0c6
1 changed files with 8 additions and 1 deletions
|
@ -152,9 +152,16 @@ struct Invidious::User
|
|||
# -------------------
|
||||
|
||||
def from_freetube(user : User, body : String)
|
||||
# Legacy import?
|
||||
matches = body.scan(/"channelId":"(?<channel_id>[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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue