Skip to content

Commit

Permalink
fix: update live id parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sawaYch committed Sep 3, 2024
1 parent e1c6a50 commit e14c166
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/next-youtube-livechat/src/libs/youtubeApiParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ export function getOptionsFromLivePage(
): FetchOptions & { liveId: string } {
let liveId: string;
const idResult = data.match(
/{"webCommandMetadata":{"url":"\/watch\?v=(.+?)","webPageType":/
/"originalUrl":"https:\/\/www.youtube.com\/watch\?v\\u003d(.+?)"/
);
console.log(idResult);
if (idResult) {
liveId = idResult[2];
liveId = idResult[0]
.replace('"originalUrl":"https://www.youtube.com/watch?v\\u003d', '')
.replace('"', '');
} else {
throw new Error('Live Stream was not found');
}
Expand Down

0 comments on commit e14c166

Please sign in to comment.