mirror of
https://github.com/iv-org/invidious.git
synced 2024-08-15 00:23:23 +02:00
Add option to import data from FreeTube
This commit is contained in:
parent
e2f27794fd
commit
324cdf545e
@ -991,6 +991,21 @@ post "/data_control" do |env|
|
|||||||
subscriptions.xpath_nodes(%q(//outline[@type="rss"])).each do |channel|
|
subscriptions.xpath_nodes(%q(//outline[@type="rss"])).each do |channel|
|
||||||
ucid = channel["xmlUrl"].match(/UC[a-zA-Z0-9_-]{22}/).not_nil![0]
|
ucid = channel["xmlUrl"].match(/UC[a-zA-Z0-9_-]{22}/).not_nil![0]
|
||||||
|
|
||||||
|
if !user.subscriptions.includes? ucid
|
||||||
|
PG_DB.exec("UPDATE users SET subscriptions = array_append(subscriptions,$1) WHERE id = $2", ucid, user.id)
|
||||||
|
|
||||||
|
begin
|
||||||
|
client = make_client(YT_URL)
|
||||||
|
get_channel(ucid, client, PG_DB, false, false)
|
||||||
|
rescue ex
|
||||||
|
next
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
when "import_freetube"
|
||||||
|
body.scan(/"channelId":"(?<channel_id>[a-zA-Z0-9_-]{24})"/).each do |md|
|
||||||
|
ucid = md["channel_id"]
|
||||||
|
|
||||||
if !user.subscriptions.includes? ucid
|
if !user.subscriptions.includes? ucid
|
||||||
PG_DB.exec("UPDATE users SET subscriptions = array_append(subscriptions,$1) WHERE id = $2", ucid, user.id)
|
PG_DB.exec("UPDATE users SET subscriptions = array_append(subscriptions,$1) WHERE id = $2", ucid, user.id)
|
||||||
|
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
<input type="file" id="import_youtube" name="import_youtube">
|
<input type="file" id="import_youtube" name="import_youtube">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pure-control-group">
|
||||||
|
<label for="import_freetube">Import Freetube subscriptions (.db)</label>
|
||||||
|
<input type="file" id="import_freetube" name="import_freetube">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="import_newpipe_subscriptions">Import NewPipe subscriptions (.json)</label>
|
<label for="import_newpipe_subscriptions">Import NewPipe subscriptions (.json)</label>
|
||||||
<input type="file" id="import_newpipe_subscriptions" name="import_newpipe_subscriptions">
|
<input type="file" id="import_newpipe_subscriptions" name="import_newpipe_subscriptions">
|
||||||
@ -39,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<a href="/subscription_manager?action_takeout=1&format=newpipe">Export subscriptions as OPML (NewPipe)</a>
|
<a href="/subscription_manager?action_takeout=1&format=newpipe">Export subscriptions as OPML (for NewPipe & FreeTube)</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user