diff --git a/src/renderer/views/Hashtag/Hashtag.js b/src/renderer/views/Hashtag/Hashtag.js index 5001d60476ba..61d0b8bead22 100644 --- a/src/renderer/views/Hashtag/Hashtag.js +++ b/src/renderer/views/Hashtag/Hashtag.js @@ -97,12 +97,26 @@ export default defineComponent({ getLocalHashtag: async function(hashtag) { try { const hashtagData = await getHashtagLocal(hashtag) - this.hashtag = hashtagData.header.hashtag - this.videos = hashtagData.contents.contents.filter(item => - item.type !== 'ContinuationItem' - ).map(item => - parseLocalListVideo(item.content) - ) + + const header = hashtagData.header + if (header) { + switch (header.type) { + case 'HashtagHeader': + this.hashtag = header.hashtag.toString() + break + case 'PageHeader': + this.hashtag = header.content.title.text + break + default: + console.error(`Unknown hashtag header type: ${header.type}, falling back to query parameter.`) + this.hashtag = `#${hashtag}` + } + } else { + console.error(' Hashtag header missing, probably a layout change, falling back to query parameter.') + this.hashtag = `#${hashtag}` + } + + this.videos = hashtagData.videos.map(parseLocalListVideo) this.apiUsed = 'local' this.hashtagContinuationData = hashtagData.has_continuation ? hashtagData : null this.isLoading = false @@ -124,12 +138,8 @@ export default defineComponent({ getLocalHashtagMore: async function() { try { - const continuation = await this.hashtagContinuationData.getContinuationData() - const newVideos = continuation.on_response_received_actions[0].contents.filter(item => - item.type !== 'ContinuationItem' - ).map(item => - parseLocalListVideo(item.content) - ) + const continuation = await this.hashtagContinuationData.getContinuation() + const newVideos = continuation.videos.map(parseLocalListVideo) this.hashtagContinuationData = continuation.has_continuation ? continuation : null this.videos = this.videos.concat(newVideos) } catch (error) {