Skip to content

Instantly share code, notes, and snippets.

@yondemon
Created October 6, 2020 08:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yondemon/7ef5f2dc1cff490b42e8e4c2d4597e75 to your computer and use it in GitHub Desktop.
Save yondemon/7ef5f2dc1cff490b42e8e4c2d4597e75 to your computer and use it in GitHub Desktop.
From My Subscriptions ivoox page, run this in console to create an opml file tu export
let hrefArray = document.querySelectorAll('table.table-list tbody tr td:nth-child(5) a')
let errors = []
let contentArray = [
'<?xml version="1.0" encoding="utf-8"?>',
'<opml version="2.0">',
' <head>',
' <title>mySubscriptions.opml</title>',
' <dateCreated></dateCreated>',
' <dateModified></dateModified>',
' <ownerName>ME</ownerName>',
' <ownerEmail></ownerEmail>',
' </head>',
' <body>',
]
function getFeeds(){
let promises = []
for(let i = 0; i < hrefArray.length; i ++) {
promises.push (new Promise( (resolve) => {
setTimeout( () => {
var item = hrefArray[i]
console.log(i, item.getAttribute('href'))
fetch(item.getAttribute('href'))
.then(response => {
return response.text()
})
.then( (data)=>{
var parser = new DOMParser();
var doc = parser.parseFromString(data, 'text/html');
var inputBlock = doc.querySelector('#rss_suscribe').closest('li').querySelector('input');
if ( inputBlock == null) {
// console.log('ERROR', item.getAttribute('href'), inputBlock )
errors.push([item.getAttribute('href'), inputBlock])
} else {
contentArray.push( `<outline title="-title-" text="${item.getAttribute('title')}" ` +
`description="-description-" ` +
`htmlUrl="" ` +
`language="unknown" type="rss" version="RSS2" `+
`xmlUrl="${inputBlock.value}"/>`)
}
resolve();
})
}, i*1000 )
}) )
}
console.log('end for', promises.length)
return promises
}
Promise
.all( getFeeds() )
.then( () => {
console.log('resolved')
contentArray.push(' </body>')
contentArray.push('</opml>')
// var blob = new Blob( contentArray, {type : 'text/xml'} )
// console.log(blob)
// console.log(errors);
// var blob = new Blob( errors.map( line => `${line}\n`), {type : 'text/plain'} )
// var blob = new Blob( errors.map( line => `<a href="${line[0]}">${line[0]}</a><br/>\n`), {type : 'text/html'} )
location.href = window.webkitURL.createObjectURL(blob)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment