OPML Export
-
Problem
I want to make an OPML file with all my vivaldi feeds in itSolution
Paste the following code into the browser console.vivaldi.prefs.get("vivaldi.rss.settings", feeds => { function html(str){return str.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');} let opml = feeds.reduce((acc, feed) => { return acc + `\n<outline type="rss" text="${html(feed.title)}" title="${html(feed.title)}" xmlUrl="${html(feed.url)}"/>`; }, `<?xml version="1.0" encoding="utf-8"?><opml version="1.0"><head><title>Feeds exported from Vivaldi</title></head><body>`); opml += `\n</body></opml>`; const filename = "exportedfeeds_"+new Date().toDateString().replace(/\s/g,"-")+".opml"; const textfile = new File([opml], filename, {type: "text/xml"}); const dl = document.createElement("a"); dl.download = filename; dl.setAttribute("href", window.URL.createObjectURL(textfile)); dl.click(); });
Notes
- Don't install it as a javascript mod, or it'll run every time you open a new window. Just paste it into the console whenever you need it.
- OPML only contains the URLs, not actual feed items.
- The file created has the date in it. If your language has strange characters, that might not work, edit the
filename
variable to change it
-
-
It has worked for me before, but fails with the most recent snapshot (returning
undefined
). Is this due to internal changes or do I miss something?// Ok, I missed something :))
See next post. -
@jumpsq Check your download folder.
-
@LonM I can't this to work on 5.3. I get the following error:
VM167:1 Uncaught ReferenceError: vivaldi is not defined
at <anonymous>:1:1I tried changing the filename parameter, and then it gives me this:
Uncaught SyntaxError: missing ) after argument list
Using Windows 10. Everything 64 bit and the latest version.
-
@fred8615 said in OPML Export:
VM167:1 Uncaught ReferenceError: vivaldi is not defined
at <anonymous>:1:1That error could show up if you are running it in the devtools console for a webpage rather than the browser interface's.
See: Inspecting the Vivaldi UI with DevTools
I tried changing the filename parameter, and then it gives me this:
Uncaught SyntaxError: missing ) after argument listWhat did you change it to?
-
@fred8615 I just tested it again, the script works. Iβd say nomadic guessed right.
-
@nomadic I got it! It was because I was trying it while here in the forum. Opened a new window and the browser interface page, and it worked.
The filename I was trying was "Vivaldi feeds", which I just discovered I was putting in the wrong place anyway.
-
This post is deleted! -
Hi @LonM, I have two questions for you.
On one hand, can't use this code. I think that is becouse I have Vivaldi on Spanish language so I don't know how modify the variable of filename.
And on the other hand, on your answer to @fred8615 you said that the error of anonym is for exect it on console devtools, but...if we don't exect on this console, where we must do it?I saw the link that you said but I have this doubt.
-
@ArchiTechOffi The filename should work even in other languages. I don't think Spanish would be too different to English.
You use the browser dev tools. You can access these using the instructions given here: https://forum.vivaldi.net/topic/16684/inspecting-the-vivaldi-ui-with-devtools?page=1
(I don't know spanish, so I can't translate unfortunately)
-
Hi I'm really trying to do this but I've never used a web dev console before. I get this error and reading through comments its unclear what I must change to avoid the error!
-
@thinkeranddoer You need to use the developer tools console of the user interface. Follow links for Β»inspecting Vivaldi UI with devtoolsΒ« above. When you do that and it works you will get an Β»undefinedΒ« in console, but the file will have downloaded. Perhaps one day @LonM will find it in him to write a closing console info with a success message
-
@luetage Any exit message that isn't an error is a success in my view.
-
@LonM neat! btw the simplest way to get to the console (shift-ctrl-i on various mail pages wasnt working for me), is to click on the mail symbol in the status bar, then the cog icon, then "view log"