mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Fix video routes generating error
This commit is contained in:
parent
5bf72f1d0a
commit
fa222d3116
5 changed files with 49 additions and 6 deletions
|
|
@ -3,9 +3,20 @@
|
|||
export function getAppEndpoint ( app ) {
|
||||
// console.log('app', app)
|
||||
|
||||
if(app.category !== Object(app.category)) {
|
||||
console.warn('app has no categories', app)
|
||||
}
|
||||
|
||||
if (app.category.slug === 'homebrew') return `/formula/${app.slug}`
|
||||
|
||||
if (app.category.slug === 'games') return `/game/${app.slug}`
|
||||
|
||||
return `/app/${app.slug}`
|
||||
}
|
||||
|
||||
export function getVideoEndpoint ( video ) {
|
||||
|
||||
return `/tv/${video.slug}`
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import slugify from 'slugify'
|
|||
import axios from 'axios'
|
||||
|
||||
import { byTimeThenNull } from './sort-list.js'
|
||||
import { getVideoEndpoint } from './app-derived.js'
|
||||
import parseGithubDate from './parse-github-date'
|
||||
|
||||
const videoFeaturesApp = function (app, video) {
|
||||
|
|
@ -30,6 +31,10 @@ export default async function ( applist ) {
|
|||
const videos = []
|
||||
|
||||
for (const videoId in fetchedVideos) {
|
||||
|
||||
// Skip private videos
|
||||
if (fetchedVideos[videoId].title === 'Private video') continue
|
||||
|
||||
// Build video slug
|
||||
const slug = slugify(`${fetchedVideos[videoId].title}-i-${videoId}`, {
|
||||
lower: true,
|
||||
|
|
@ -61,7 +66,9 @@ export default async function ( applist ) {
|
|||
slug,
|
||||
timestamps: fetchedVideos[videoId].timestamps,
|
||||
thumbnails: fetchedVideos[videoId].rawData.snippet.thumbnails,
|
||||
endpoint: `/tv/${slug}`
|
||||
endpoint: getVideoEndpoint({
|
||||
slug
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue