Add subscription JSON export for NewPipe - #5826
Open
unrealtournament wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a NewPipe-compatible subscription export option because NewPipe no longer accepts the existing OPML export format for subscriptions.
Changes:
- Adds a NewPipe subscription JSON export generator (
to_newpipe). - Updates the user data control page to expose separate export options for FreeTube (OPML) and NewPipe (JSON).
- Adjusts
/subscription_managertakeout routing to serve either Invidious JSON, NewPipe JSON, or OPML.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/invidious/views/user/data_control.ecr | Adds new export links/options in the user data control UI. |
| src/invidious/user/exports.cr | Implements NewPipe subscription JSON export generation. |
| src/invidious/routes/subscriptions.cr | Routes takeout requests to the appropriate export format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+5
to
+23
| def to_newpipe(subscriptions) | ||
| return JSON.build do |json| | ||
| json.object do | ||
| json.field "subscriptions" do | ||
| json.array do | ||
| subscriptions.each do |channel| | ||
| json.object do | ||
| json.field "service_id", 0 | ||
| json.field "url", "https://www.youtube.com/channel/" + channel.id | ||
| json.field "name", channel.author | ||
| end | ||
| end | ||
| end | ||
| end | ||
| json.field "app_version", "0.29.0" | ||
| json.field "app_version_int", 1014 | ||
| end | ||
| end | ||
| end |
Comment on lines
+60
to
+64
| <a href="/subscription_manager?action_takeout=1&format=opml_freetube"><%= I18n.translate(locale, "Export subscriptions as OPML (for FreeTube)") %></a> | ||
| </div> | ||
|
|
||
| <div class="pure-control-group"> | ||
| <a href="/subscription_manager?action_takeout=1&format=newpipe_json"><%= I18n.translate(locale, "Export subscriptions as JSON (for NewPipe)") %></a> |
Comment on lines
+95
to
102
| title = "Invidious Subscriptions" | ||
|
|
||
| xml.element("outline", text: title, title: title) do | ||
| subscriptions.each do |channel| | ||
| if format == "newpipe" | ||
| xml_url = "https://www.youtube.com/feeds/videos.xml?channel_id=#{channel.id}" | ||
| else | ||
| xml_url = "#{HOST_URL}/feed/channel/#{channel.id}" | ||
| end | ||
| xml_url = "#{HOST_URL}/feed/channel/#{channel.id}" | ||
|
|
||
| xml.element("outline", text: channel.author, title: channel.author, | ||
| "type": "rss", xmlUrl: xml_url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
AI Disclosure
Pull request description
The current option to export subscriptions for NewPipe (
Export subscriptions as OPML (for NewPipe & FreeTube)) isn't accepted by NewPipe anymore. As far as I can tell, NewPipe only accepts importing from its own SQLite database, from Google Account CSV export and from its own JSON export format. This is mentioned in #5438.This PR adds support to export subscriptions in the NewPipe compatible format. I'm looking for input on a few points:
(for NewPipe)part.The new format looks like this:
The new options in the frontend look like: