mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Put CSV import function under its own module
This commit is contained in:
parent
ad4a06fca5
commit
ef8dc7272b
1 changed files with 24 additions and 18 deletions
|
@ -1,6 +1,11 @@
|
||||||
require "csv"
|
require "csv"
|
||||||
|
|
||||||
def parse_subscription_export_csv(csv_content : String)
|
struct Invidious::User
|
||||||
|
module Import
|
||||||
|
extend self
|
||||||
|
|
||||||
|
# Parse a youtube CSV subscription file
|
||||||
|
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…
Reference in a new issue