Skip to content

Move Invidious API calls into Invidious file #6313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 3 additions & 13 deletions src/renderer/components/subscriptions-live/subscriptions-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import SubscriptionsTabUI from '../subscriptions-tab-ui/subscriptions-tab-ui.vue

import {
getChannelPlaylistId,
setPublishedTimestampsInvidious,
copyToClipboard,
getRelativeTimeFromDate,
showToast
} from '../../helpers/utils'
import { invidiousAPICall, invidiousFetch } from '../../helpers/api/invidious'
import { getInvidiousChannelLive, invidiousFetch } from '../../helpers/api/invidious'
import { getLocalChannelLiveStreams } from '../../helpers/api/local'
import { parseYouTubeRSSFeed, updateVideoListAfterProcessing } from '../../helpers/subscriptions'

Expand Down Expand Up @@ -338,17 +337,8 @@ export default defineComponent({

getChannelLiveInvidious: function (channel, failedAttempts = 0) {
return new Promise((resolve, reject) => {
const subscriptionsPayload = {
resource: 'channels',
id: channel.id,
subResource: 'streams',
params: {}
}

invidiousAPICall(subscriptionsPayload).then((result) => {
const videos = result.videos.filter(e => e.type === 'video')

setPublishedTimestampsInvidious(videos)
getInvidiousChannelLive(channel.id).then((result) => {
const videos = result.videos

let name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { mapActions, mapMutations } from 'vuex'
import SubscriptionsTabUI from '../subscriptions-tab-ui/subscriptions-tab-ui.vue'

import {
setPublishedTimestampsInvidious,
copyToClipboard,
getRelativeTimeFromDate,
showToast,
getChannelPlaylistId
} from '../../helpers/utils'
import { invidiousAPICall, invidiousFetch } from '../../helpers/api/invidious'
import { getInvidiousChannelVideos, invidiousFetch } from '../../helpers/api/invidious'
import { getLocalChannelVideos } from '../../helpers/api/local'
import { parseYouTubeRSSFeed, updateVideoListAfterProcessing } from '../../helpers/subscriptions'

Expand Down Expand Up @@ -342,16 +341,7 @@ export default defineComponent({

getChannelVideosInvidiousScraper: function (channel, failedAttempts = 0) {
return new Promise((resolve, reject) => {
const subscriptionsPayload = {
resource: 'channels',
id: channel.id,
subResource: 'videos',
params: {}
}

invidiousAPICall(subscriptionsPayload).then((result) => {
setPublishedTimestampsInvidious(result.videos)

getInvidiousChannelVideos(channel.id).then((result) => {
let name

if (result.videos.length > 0) {
Expand Down
12 changes: 2 additions & 10 deletions src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IpcChannels, KeyboardShortcuts, MOBILE_WIDTH_THRESHOLD } from '../../..
import { localizeAndAddKeyboardShortcutToActionTitle, openInternalPath } from '../../helpers/utils'
import { translateWindowTitle } from '../../helpers/strings'
import { clearLocalSearchSuggestionsSession, getLocalSearchSuggestions } from '../../helpers/api/local'
import { invidiousAPICall } from '../../helpers/api/invidious'
import { getInvidiousSearchSuggestions } from '../../helpers/api/invidious'

const NAV_HISTORY_DISPLAY_LIMIT = 15
const HALF_OF_NAV_HISTORY_DISPLAY_LIMIT = Math.floor(NAV_HISTORY_DISPLAY_LIMIT / 2)
Expand Down Expand Up @@ -326,15 +326,7 @@ export default defineComponent({
return
}

const searchPayload = {
resource: 'search/suggestions',
id: '',
params: {
q: query
}
}

invidiousAPICall(searchPayload).then((results) => {
getInvidiousSearchSuggestions(query).then((results) => {
this.searchSuggestionsDataList = results.suggestions
}).catch((err) => {
console.error(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mapMutations } from 'vuex'
import FtLoader from '../ft-loader/ft-loader.vue'
import FtCard from '../ft-card/ft-card.vue'
import FtListVideoNumbered from '../ft-list-video-numbered/ft-list-video-numbered.vue'
import { copyToClipboard, setPublishedTimestampsInvidious, showToast } from '../../helpers/utils'
import { copyToClipboard, showToast } from '../../helpers/utils'
import {
getLocalPlaylist,
parseLocalPlaylistVideo,
Expand Down Expand Up @@ -471,7 +471,6 @@ export default defineComponent({
this.channelName = result.author
this.channelId = result.authorId

setPublishedTimestampsInvidious(result.videos)
this.playlistItems = this.playlistItems.concat(result.videos)

this.isLoading = false
Expand Down
Loading
Loading