forked from Mastodon/mastoradio-la-radio-di-mastodon
Add compatibility for known invidious links
This commit is contained in:
parent
6040bc1322
commit
28db158d00
|
@ -4,6 +4,14 @@ import { mapNullable } from '/services/misc.js'
|
|||
|
||||
const LINK_RE = /<(.+?)>; rel="(\w+)"/gi
|
||||
|
||||
const YoutubeInstances = [
|
||||
'youtube.com', 'm.youtube.com', 'music.youtube.com',
|
||||
'invidio.us', 'redirect.invidious.io',
|
||||
'invidious.snopyta.org', 'yewtu.be', 'invidious.kavin.rocks', 'vid.puffyan.us', 'invidious.namazso.eu', 'inv.riverside.rocks', 'invidious.osi.kr', 'youtube.076.ne.jp', 'yt.artemislena.eu', 'tube.cthd.icu', 'invidious.flokinet.to', 'invidious.weblibre.org', 'invidious.esmailelbob.xyz', 'invidious.lunar.icu', 'invidious.mutahar.rocks', 'inv.bp.projectsegfau.lt', 'y.com.sb', 'invidious.sethforprivacy.com', 'invidious.tiekoetter.com', 'invidious.hub.ne.kr',
|
||||
'videos.arci.me', 'octt.ddns.net:48864',
|
||||
'c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion', 'w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion', 'kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion', 'grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion', 'osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion', 'u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion', 'euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion'
|
||||
]
|
||||
|
||||
function parseLinkHeader(linkHeader) {
|
||||
const links = new Map()
|
||||
|
||||
|
@ -196,7 +204,7 @@ const findMedia = status => execPipe(
|
|||
map(url => {
|
||||
const { hostname, pathname, searchParams } = new URL(url)
|
||||
|
||||
if (['youtube.com', 'm.youtube.com', 'music.youtube.com', 'invidio.us'].includes(hostname) && searchParams.has('v')) {
|
||||
if (YoutubeInstances.includes(hostname) && searchParams.has('v')) {
|
||||
return { url, credentials: { type: 'youtube', id: searchParams.get('v') } }
|
||||
} else if (hostname === 'youtu.be') {
|
||||
return { url, credentials: { type: 'youtube', id: pathname.substring(1) } }
|
||||
|
|
Loading…
Reference in New Issue