7
7
has,
8
8
isEmpty,
9
9
isNil,
10
- isString,
11
10
negate,
12
11
overEvery
13
12
} = require ( 'lodash' )
@@ -18,7 +17,8 @@ const {
18
17
author : authorFn ,
19
18
description : descriptionFn ,
20
19
title : titleFn ,
21
- url : urlFn
20
+ url : urlFn ,
21
+ publisher
22
22
} = require ( '@metascraper/helpers' )
23
23
24
24
const createGetVideoInfo = require ( './get-video-info' )
@@ -85,7 +85,7 @@ const getAuthor = ({ uploader, creator, uploader_id: uploaderId }) =>
85
85
find ( [ creator , uploader , uploaderId ] , str => authorFn ( str ) )
86
86
87
87
const getPublisher = ( { extractor_key : extractorKey } ) =>
88
- isString ( extractorKey ) && extractorKey
88
+ publisher ( extractorKey )
89
89
90
90
const getTitle = ( { title : mainTitle , alt_title : secondaryTitle } ) =>
91
91
find ( [ mainTitle , secondaryTitle ] , titleFn )
@@ -101,11 +101,7 @@ module.exports = opts => {
101
101
const getVideoInfo = createGetVideoInfo ( opts )
102
102
103
103
return {
104
- video : async ( { url } ) => {
105
- const payload = await getVideoInfo ( url )
106
- // console.log(JSON.stringify(payload))
107
- return getVideo ( payload )
108
- } ,
104
+ video : async ( { url } ) => getVideo ( await getVideoInfo ( url ) ) ,
109
105
audio : async ( { url } ) => getAudio ( await getVideoInfo ( url ) ) ,
110
106
author : async ( { url } ) => getAuthor ( await getVideoInfo ( url ) ) ,
111
107
publisher : async ( { url } ) => getPublisher ( await getVideoInfo ( url ) ) ,
0 commit comments