Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Sep 1, 2018
1 parent 00584d3 commit 10faffd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/metascraper-media-provider/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {
has,
isEmpty,
isNil,
isString,
negate,
overEvery
} = require('lodash')
Expand All @@ -18,7 +17,8 @@ const {
author: authorFn,
description: descriptionFn,
title: titleFn,
url: urlFn
url: urlFn,
publisher
} = require('@metascraper/helpers')

const createGetVideoInfo = require('./get-video-info')
Expand Down Expand Up @@ -85,7 +85,7 @@ const getAuthor = ({ uploader, creator, uploader_id: uploaderId }) =>
find([creator, uploader, uploaderId], str => authorFn(str))

const getPublisher = ({ extractor_key: extractorKey }) =>
isString(extractorKey) && extractorKey
publisher(extractorKey)

const getTitle = ({ title: mainTitle, alt_title: secondaryTitle }) =>
find([mainTitle, secondaryTitle], titleFn)
Expand All @@ -101,11 +101,7 @@ module.exports = opts => {
const getVideoInfo = createGetVideoInfo(opts)

return {
video: async ({ url }) => {
const payload = await getVideoInfo(url)
// console.log(JSON.stringify(payload))
return getVideo(payload)
},
video: async ({ url }) => getVideo(await getVideoInfo(url)),
audio: async ({ url }) => getAudio(await getVideoInfo(url)),
author: async ({ url }) => getAuthor(await getVideoInfo(url)),
publisher: async ({ url }) => getPublisher(await getVideoInfo(url)),
Expand Down

0 comments on commit 10faffd

Please sign in to comment.