Put CSV import function under its own module

pull/2871/head
Samantaz Fox 3 years ago
parent ad4a06fca5
commit ef8dc7272b
No known key found for this signature in database
GPG Key ID: F42821059186176E

@ -1,5 +1,10 @@
require "csv" require "csv"
struct Invidious::User
module Import
extend self
# Parse a youtube CSV subscription file
def parse_subscription_export_csv(csv_content : String) def parse_subscription_export_csv(csv_content : String)
rows = CSV.new(csv_content, headers: true) rows = CSV.new(csv_content, headers: true)
subscriptions = Array(String).new subscriptions = Array(String).new
@ -19,9 +24,10 @@ def parse_subscription_export_csv(csv_content : String)
channel_id = row[0].strip channel_id = row[0].strip
next if channel_id.empty? next if channel_id.empty?
subscriptions << channel_id subscriptions << channel_id
end end
return subscriptions return subscriptions
end end
end
end

Loading…
Cancel
Save