Correct handling of Invidious links in direct share form and with explicit port
This commit is contained in:
parent
7ddd5ee83d
commit
e3b4325b42
|
@ -5,9 +5,9 @@ import { mapNullable } from '/src/services/misc.js'
|
|||
|
||||
const LINK_RE = /<(.+?)>; rel="(\w+)"/gi
|
||||
|
||||
// Add compatibility for watch?v= links of known invidious/piped instances
|
||||
const YoutubeInstances = [
|
||||
'youtube.com', 'm.youtube.com', 'music.youtube.com',
|
||||
const YoutubeDomains = ['youtube.com', 'm.youtube.com', 'music.youtube.com']
|
||||
const YoutubeDirect = ['youtu.be']
|
||||
const InvidiousDomains = [
|
||||
'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',
|
||||
|
@ -205,11 +205,16 @@ const findMedia = status => execPipe(
|
|||
status.content,
|
||||
getUrls,
|
||||
map(url => {
|
||||
const { hostname, pathname, searchParams } = new URL(url)
|
||||
const { hostname, port, pathname, searchParams } = new URL(url)
|
||||
if (!port) {
|
||||
const website = hostname
|
||||
} else {
|
||||
const website = hostname + ':' + port
|
||||
}
|
||||
|
||||
if (YoutubeInstances.includes(hostname) && searchParams.has('v')) {
|
||||
if (InvidiousDomains.concat(YoutubeDomains).includes(website) && searchParams.has('v')) {
|
||||
return { url, credentials: { type: 'youtube', id: searchParams.get('v') } }
|
||||
} else if (hostname === 'youtu.be') {
|
||||
} else if (InvidiousDomains.concat(YoutubeDirect).includes(website) && !searchParams.has('v')) {
|
||||
return { url, credentials: { type: 'youtube', id: pathname.substring(1) } }
|
||||
} else {
|
||||
return null
|
||||
|
|
Loading…
Reference in New Issue