ai-tube / src /app /api /utils /isHighQuality.ts
jbilcke-hf's picture
jbilcke-hf HF staff
working on some new features
3d4392e
raw
history blame
No virus
773 Bytes
import { MediaInfo } from "@/types/general"
export function isHighQuality(video: MediaInfo) {
const numberOfViews = Math.abs(Math.max(0, video.numberOfViews))
const numberOfLikes = Math.abs(Math.max(0, video.numberOfLikes))
const numberOfDislikes = Math.abs(Math.max(0, video.numberOfDislikes))
// rock star videos will quickly reach high ratings
const isVeryPopular = numberOfViews > 100000 || numberOfLikes > 100000
if (isVeryPopular) { return true }
const rating = numberOfLikes - numberOfDislikes
// while the number of dislike should be enough, some content is so bad that
// people don't even take the time to watch and dislike it
// so we might add other roules
const isAppreciatedByPeople = rating > 0
return isAppreciatedByPeople
}