Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Fix for channels with no secondary links #61

Merged
merged 5 commits into from
Mar 15, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions app/youtube-grabber.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@ class YoutubeGrabber {
title: x.title.simpleText
}
})
links.secondaryLinks = channelHeaderLinksData.secondaryLinks.map(x => {
const url = x.navigationEndpoint.urlEndpoint.url
const match = url.match('&q=(.*)')
return {
url: match === null ? url : decodeURIComponent(match[1]),
icon: x.icon.thumbnails[0].url,
title: x.title.simpleText
}
})
if (typeof channelHeaderLinksData.secondaryLinks !== 'undefined') {
links.secondaryLinks = channelHeaderLinksData.secondaryLinks.map(x => {
const url = x.navigationEndpoint.urlEndpoint.url
const match = url.match('&q=(.*)')
return {
url: match === null ? url : decodeURIComponent(match[1]),
icon: x.icon.thumbnails[0].url,
title: x.title.simpleText
}
})
}
}

ChunkyProgrammer marked this conversation as resolved.
Show resolved Hide resolved
if (typeof (channelPageResponse.data[1].response.alerts) !== 'undefined') {
return {
alertMessage: channelPageResponse.data[1].response.alerts[0].alertRenderer.text.simpleText
Expand Down