Fix #25
This commit is contained in:
parent
3103d3e098
commit
db80b929ca
@ -27,6 +27,7 @@ import sharp from 'sharp';
|
||||
import { WebSocket } from 'ws';
|
||||
|
||||
const URL_REGEX = new RegExp(/href="(?<postUrl>[^>]+?)" target="_blank"/gm);
|
||||
const INVIDIOUS_REGEX = new RegExp(/invidious.*?watch.*?v=(?<videoId>[a-zA-Z_0-9-]+)/gm);
|
||||
|
||||
export class TimelineReader {
|
||||
private static _instance: TimelineReader;
|
||||
@ -71,8 +72,12 @@ export class TimelineReader {
|
||||
return null;
|
||||
}
|
||||
|
||||
const videoId = INVIDIOUS_REGEX.exec(url.href)?.groups?.videoId;
|
||||
const urlString =
|
||||
videoId !== undefined ? `https://youtube.com/watch?v=${videoId}` : url.toString();
|
||||
|
||||
const odesliParams = new URLSearchParams();
|
||||
odesliParams.append('url', url.toString());
|
||||
odesliParams.append('url', urlString);
|
||||
odesliParams.append('userCountry', 'DE');
|
||||
odesliParams.append('songIfSingle', 'true');
|
||||
if (ODESLI_API_KEY && ODESLI_API_KEY !== 'CHANGE_ME') {
|
||||
|
Loading…
Reference in New Issue
Block a user