mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-26 10:49:00 +02:00
Add:OPML Upload for bulk adding podcasts #588
This commit is contained in:
parent
e5469cc0f8
commit
514893646a
16 changed files with 359 additions and 18 deletions
24
server/utils/parsers/parseOPML.js
Normal file
24
server/utils/parsers/parseOPML.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const h = require('htmlparser2')
|
||||
const Logger = require('../../Logger')
|
||||
|
||||
function parse(opmlText) {
|
||||
var feeds = []
|
||||
var parser = new h.Parser({
|
||||
onopentag: (name, attribs) => {
|
||||
if (name === "outline" && attribs.type === 'rss') {
|
||||
if (!attribs.xmlurl) {
|
||||
Logger.error('[parseOPML] Invalid opml outline tag has no xmlurl attribute')
|
||||
} else {
|
||||
feeds.push({
|
||||
title: attribs.title || 'No Title',
|
||||
text: attribs.text || '',
|
||||
feedUrl: attribs.xmlurl
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
parser.write(opmlText)
|
||||
return feeds
|
||||
}
|
||||
module.exports.parse = parse
|
Loading…
Add table
Add a link
Reference in a new issue