Created
October 6, 2020 08:06
-
-
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
This file contains 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
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