mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-01 00:18:14 +01:00
Fix:RSS feeds that include an id as a query string #1896
This commit is contained in:
parent
65cf928afe
commit
00a02921dd
@ -110,7 +110,10 @@ export default {
|
|||||||
itemEpisodeMap() {
|
itemEpisodeMap() {
|
||||||
const map = {}
|
const map = {}
|
||||||
this.itemEpisodes.forEach((item) => {
|
this.itemEpisodes.forEach((item) => {
|
||||||
if (item.enclosure) map[item.enclosure.url.split('?')[0]] = true
|
if (item.enclosure) {
|
||||||
|
const cleanUrl = this.getCleanEpisodeUrl(item.enclosure.url)
|
||||||
|
map[cleanUrl] = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return map
|
return map
|
||||||
},
|
},
|
||||||
@ -129,6 +132,29 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* RSS feed episode url is used for matching with existing downloaded episodes.
|
||||||
|
* Some RSS feeds include timestamps in the episode url (e.g. patreon) that can change on requests.
|
||||||
|
* These need to be removed in order to detect the same episode each time the feed is pulled.
|
||||||
|
*
|
||||||
|
* An RSS feed may include an `id` in the query string. In these cases we want to leave the `id`.
|
||||||
|
* @see https://github.com/advplyr/audiobookshelf/issues/1896
|
||||||
|
*
|
||||||
|
* @param {string} url - rss feed episode url
|
||||||
|
* @returns {string} rss feed episode url without dynamic query strings
|
||||||
|
*/
|
||||||
|
getCleanEpisodeUrl(url) {
|
||||||
|
let queryString = url.split('?')[1]
|
||||||
|
if (!queryString) return url
|
||||||
|
|
||||||
|
const searchParams = new URLSearchParams(queryString)
|
||||||
|
for (const p of Array.from(searchParams.keys())) {
|
||||||
|
if (p !== 'id') searchParams.delete(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!searchParams.toString()) return url
|
||||||
|
return `${url}?${searchParams.toString()}`
|
||||||
|
},
|
||||||
inputUpdate() {
|
inputUpdate() {
|
||||||
clearTimeout(this.searchTimeout)
|
clearTimeout(this.searchTimeout)
|
||||||
this.searchTimeout = setTimeout(() => {
|
this.searchTimeout = setTimeout(() => {
|
||||||
@ -198,7 +224,7 @@ export default {
|
|||||||
.map((_ep) => {
|
.map((_ep) => {
|
||||||
return {
|
return {
|
||||||
..._ep,
|
..._ep,
|
||||||
cleanUrl: _ep.enclosure.url.split('?')[0]
|
cleanUrl: this.getCleanEpisodeUrl(_ep.enclosure.url)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.episodesCleaned.sort((a, b) => (a.publishedAt < b.publishedAt ? 1 : -1))
|
this.episodesCleaned.sort((a, b) => (a.publishedAt < b.publishedAt ? 1 : -1))
|
||||||
|
Loading…
Reference in New Issue
Block a user