import { parseMediaAndBanner } from "../../base/util.mjs"

export function parseVideos(videos) {
  for (let i = 0; i < videos.length; i++) {
    parseVideo(videos[i])
  }
  return videos
}

export function parseVideo(video) {
  if (!video) {
    return null
  }
  parseMediaAndBanner(video)
  video.metadata = JSON.parse(video.metadata || '{}')
  delete video.banner_alt_prefix
  delete video.media_alt_prefix
  return video
}