update yt-channel-info (#2126)

* update yt-channel-info

* update to 3.0.1

* Update yarn.lock
This commit is contained in:
ChunkyProgrammer 2022-04-05 23:05:15 -04:00 committed by GitHub
parent 40ac959684
commit 927225d1f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 16 deletions

View File

@ -89,7 +89,7 @@
"vue-router": "^3.5.2", "vue-router": "^3.5.2",
"vuex": "^3.6.2", "vuex": "^3.6.2",
"youtube-suggest": "^1.1.2", "youtube-suggest": "^1.1.2",
"yt-channel-info": "^2.2.0", "yt-channel-info": "^3.0.1",
"yt-dash-manifest-generator": "1.1.0", "yt-dash-manifest-generator": "1.1.0",
"yt-trending-scraper": "^2.0.1", "yt-trending-scraper": "^2.0.1",
"ytdl-core": "^4.10.1", "ytdl-core": "^4.10.1",

View File

@ -1303,7 +1303,7 @@ export default Vue.extend({
getChannelInfoLocal: function (channelId) { getChannelInfoLocal: function (channelId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
ytch.getChannelInfo(channelId, 'latest').then(async (response) => { ytch.getChannelInfo({ channelId: channelId }).then(async (response) => {
resolve(response) resolve(response)
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)

View File

@ -249,7 +249,7 @@ export default Vue.extend({
getChannelInfoLocal: function () { getChannelInfoLocal: function () {
this.apiUsed = 'local' this.apiUsed = 'local'
ytch.getChannelInfo(this.id).then((response) => { ytch.getChannelInfo({ channelId: this.id }).then((response) => {
this.id = response.authorId this.id = response.authorId
this.channelName = response.author this.channelName = response.author
document.title = `${this.channelName} - ${process.env.PRODUCT_NAME}` document.title = `${this.channelName} - ${process.env.PRODUCT_NAME}`
@ -258,16 +258,18 @@ export default Vue.extend({
} else { } else {
this.subCount = response.subscriberCount.toFixed(0) this.subCount = response.subscriberCount.toFixed(0)
} }
console.log(response)
this.thumbnailUrl = response.authorThumbnails[2].url this.thumbnailUrl = response.authorThumbnails[2].url
this.channelDescription = autolinker.link(response.description) this.channelDescription = autolinker.link(response.description)
this.relatedChannels = response.relatedChannels.items this.relatedChannels = response.relatedChannels.items
this.relatedChannels.forEach(relatedChannel => { this.relatedChannels.forEach(relatedChannel => {
relatedChannel.authorThumbnails.map(thumbnail => { relatedChannel.thumbnail.map(thumbnail => {
if (!thumbnail.url.includes('https')) { if (!thumbnail.url.includes('https')) {
thumbnail.url = `https:${thumbnail.url}` thumbnail.url = `https:${thumbnail.url}`
} }
return thumbnail return thumbnail
}) })
relatedChannel.authorThumbnails = relatedChannel.thumbnail
}) })
if (response.authorBanners !== null) { if (response.authorBanners !== null) {
@ -306,7 +308,7 @@ export default Vue.extend({
getChannelVideosLocal: function () { getChannelVideosLocal: function () {
this.isElementListLoading = true this.isElementListLoading = true
ytch.getChannelVideos(this.id, this.videoSortBy).then((response) => { ytch.getChannelVideos({ channelId: this.id, sortBy: this.videoSortBy }).then((response) => {
this.latestVideos = response.items this.latestVideos = response.items
this.videoContinuationString = response.continuation this.videoContinuationString = response.continuation
this.isElementListLoading = false this.isElementListLoading = false
@ -332,7 +334,7 @@ export default Vue.extend({
}, },
channelLocalNextPage: function () { channelLocalNextPage: function () {
ytch.getChannelVideosMore(this.videoContinuationString).then((response) => { ytch.getChannelVideosMore({ continuation: this.videoContinuationString }).then((response) => {
this.latestVideos = this.latestVideos.concat(response.items) this.latestVideos = this.latestVideos.concat(response.items)
this.videoContinuationString = response.continuation this.videoContinuationString = response.continuation
}).catch((err) => { }).catch((err) => {
@ -418,7 +420,7 @@ export default Vue.extend({
}, },
getPlaylistsLocal: function () { getPlaylistsLocal: function () {
ytch.getChannelPlaylistInfo(this.id, this.playlistSortBy).then((response) => { ytch.getChannelPlaylistInfo({ channelId: this.id, sortBy: this.playlistSortBy }).then((response) => {
console.log(response) console.log(response)
this.latestPlaylists = response.items.map((item) => { this.latestPlaylists = response.items.map((item) => {
item.proxyThumbnail = false item.proxyThumbnail = false
@ -448,7 +450,7 @@ export default Vue.extend({
}, },
getPlaylistsLocalMore: function () { getPlaylistsLocalMore: function () {
ytch.getChannelPlaylistsMore(this.playlistContinuationString).then((response) => { ytch.getChannelPlaylistsMore({ continuation: this.playlistContinuationString }).then((response) => {
console.log(response) console.log(response)
this.latestPlaylists = this.latestPlaylists.concat(response.items) this.latestPlaylists = this.latestPlaylists.concat(response.items)
this.playlistContinuationString = response.continuation this.playlistContinuationString = response.continuation
@ -638,7 +640,7 @@ export default Vue.extend({
searchChannelLocal: function () { searchChannelLocal: function () {
if (this.searchContinuationString === '') { if (this.searchContinuationString === '') {
ytch.searchChannel(this.id, this.lastSearchQuery).then((response) => { ytch.searchChannel({ channelId: this.id, query: this.lastSearchQuery }).then((response) => {
console.log(response) console.log(response)
this.searchResults = response.items this.searchResults = response.items
this.isElementListLoading = false this.isElementListLoading = false
@ -663,7 +665,7 @@ export default Vue.extend({
} }
}) })
} else { } else {
ytch.searchChannelMore(this.searchContinuationString).then((response) => { ytch.searchChannelMore({ continuation: this.searchContinuationString }).then((response) => {
console.log(response) console.log(response)
this.searchResults = this.searchResults.concat(response.items) this.searchResults = this.searchResults.concat(response.items)
this.isElementListLoading = false this.isElementListLoading = false

View File

@ -138,7 +138,7 @@
<ft-channel-bubble <ft-channel-bubble
v-for="(channel, index) in relatedChannels" v-for="(channel, index) in relatedChannels"
:key="index" :key="index"
:channel-name="channel.author" :channel-name="channel.author || channel.channelName"
:channel-id="channel.authorId" :channel-id="channel.authorId"
:channel-thumbnail="channel.authorThumbnails[channel.authorThumbnails.length - 1].url" :channel-thumbnail="channel.authorThumbnails[channel.authorThumbnails.length - 1].url"
@click="goToChannel(channel.authorId)" @click="goToChannel(channel.authorId)"

View File

@ -225,7 +225,7 @@ export default Vue.extend({
getChannelVideosLocalScraper: function (channel, failedAttempts = 0) { getChannelVideosLocalScraper: function (channel, failedAttempts = 0) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
ytch.getChannelVideos(channel.id, 'latest').then(async (response) => { ytch.getChannelVideos({ channelId: channel.id, sortBy: 'latest' }).then(async (response) => {
const videos = await Promise.all(response.items.map(async (video) => { const videos = await Promise.all(response.items.map(async (video) => {
if (video.liveNow) { if (video.liveNow) {
video.publishedDate = new Date().getTime() video.publishedDate = new Date().getTime()

View File

@ -9050,10 +9050,10 @@ youtube-suggest@^1.1.2:
node-fetch "^2.6.0" node-fetch "^2.6.0"
smol-jsonp "^1.0.0" smol-jsonp "^1.0.0"
yt-channel-info@^2.2.0: yt-channel-info@^3.0.1:
version "2.2.0" version "3.0.1"
resolved "https://registry.yarnpkg.com/yt-channel-info/-/yt-channel-info-2.2.0.tgz#3e5d608916fcef79e473e16a779c23ea0ac41d71" resolved "https://registry.yarnpkg.com/yt-channel-info/-/yt-channel-info-3.0.1.tgz#cb6651111a59018379110fe4846dd8ba2260b76c"
integrity sha512-P8WWBKQxIEZ23UmKzfHpCI4zgIBGpmthsT+oDPDfNYH0VweWHgHMsLphopMJe2y+FElz/b/N1yo5v4vwrteGRQ== integrity sha512-iaW+/PcYpodVmwkVgsL7aKrAn7V2TqBS7AD48y7Y2xTjOphytuXhINjpU87IPMoANwJAxbF4sDk8Xz921l5wxg==
dependencies: dependencies:
axios "^0.21.1" axios "^0.21.1"
querystring "^0.2.0" querystring "^0.2.0"