Skip to content

Commit

Permalink
Fix for channels with no secondary links (FreeTubeApp#61)
Browse files Browse the repository at this point in the history
* Update youtube-grabber.js

* Update youtube-grabber.js

* Update youtube-grabber.js

* Update youtube-grabber.js

* remove unnecessary space

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
  • Loading branch information
3 people authored Mar 15, 2022
1 parent 3291db3 commit 243483f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/youtube-grabber.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ 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
}
})
}
}

if (typeof (channelPageResponse.data[1].response.alerts) !== 'undefined') {
return {
alertMessage: channelPageResponse.data[1].response.alerts[0].alertRenderer.text.simpleText
Expand Down

0 comments on commit 243483f

Please sign in to comment.