Skip to content

Commit

Permalink
Update dependencies (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats authored Nov 16, 2018
1 parent cf8cd92 commit a256f0c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/metascraper-clearbit-logo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"metascraper"
],
"dependencies": {
"got": "~9.2.0"
"got": "~9.3.2"
},
"devDependencies": {
"mocha": "latest",
Expand Down
8 changes: 7 additions & 1 deletion packages/metascraper-helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const isIso = require('isostring')
const toTitle = require('title')

const { URL } = require('url')
const urlLib = require('url')

const MIMES_EXTENSIONS = {
audio: audioExtensions,
Expand Down Expand Up @@ -105,7 +106,12 @@ const isAudioExtension = createExtensionValidator(audioExtensions)

const isImageExtension = createExtensionValidator(imageExtensions)

const extension = url => fileExtension(url).split('?')[0]
const extension = (str = '') => {
const urlObj = urlLib.parse(str)
urlObj.hash = ''
urlObj.search = ''
return fileExtension(urlLib.format(urlObj))
}

const description = value => isString(value) && getDescription(value)

Expand Down
2 changes: 1 addition & 1 deletion packages/metascraper-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"isostring": "0.0.1",
"lodash": "~4.17.11",
"mime-types": "~2.1.21",
"normalize-url": "~3.3.0",
"normalize-url": "~4.0.0",
"smartquotes": "~2.3.1",
"title": "~3.4.0",
"url-regex": "~4.1.1",
Expand Down
11 changes: 9 additions & 2 deletions packages/metascraper-helpers/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

const should = require('should')

const { absoluteUrl } = require('../')
const { extension, absoluteUrl } = require('../')

describe('metascraper-helpers', () => {
it('absoluteUrl', () => {
it('.absoluteUrl', () => {
should(absoluteUrl('https://kikobeats.com/', 'blog')).be.equal(
'https://kikobeats.com/blog'
)
Expand All @@ -19,4 +19,11 @@ describe('metascraper-helpers', () => {
'http://kikobeats.com/blog'
)
})

it('.extension', () => {
should(extension('.mp4')).be.equal('mp4')
should(extension('.mp4#t=0')).be.equal('mp4')
should(extension('.mp4?foo=bar')).be.equal('mp4')
should(extension('.mp4?foo=bar#t=0')).be.equal('mp4')
})
})
1 change: 1 addition & 0 deletions packages/metascraper-logo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@metascraper/helpers": "^4.5.5",
"got": "~9.3.2",
"lodash": "~4.17.10"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/metascraper-media-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
},
"dependencies": {
"@metascraper/helpers": "^4.5.5",
"got": "~9.2.0",
"got": "~9.3.2",
"lodash": "~4.17.10",
"memoize-one": "~4.0.2",
"memoize-one": "~4.0.3",
"memoize-token": "~1.1.0",
"tunnel": "0.0.6",
"youtube-dl": "~1.12.2"
},
"devDependencies": {
"browserless": "~4.1.3",
"browserless": "~4.2.1",
"mocha": "latest",
"nyc": "latest",
"puppeteer": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports['single src 1'] = {

exports['clips.twitch.tv 1'] = {
"image": "https://clips-media-assets.twitch.tv/27434665136-offset-2366-preview.jpg",
"video": "https://clips-media-assets.twitch.tv/AT-27434665136-offset-2366-1280x720.mp4"
"video": "https://clips-media-assets.twitch.tv/AT-27434665136-offset-2366-1280x720.mp4#t=0"
}

exports['play.tv 1'] = {
Expand Down
3 changes: 1 addition & 2 deletions packages/metascraper-video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ const wrapVideo = createWrapper((domNodes, url) => {
.orderBy(videoUrl => extension(videoUrl) === 'mp4', ['desc'])
.first()
.value()

const urlValue = urlFn(videoUrl, { url })
return isVideoUrl(urlValue) && urlValue
})

const withContentType = (url, contentType) =>
(isMime(contentType, 'video') ? url : false)
isMime(contentType, 'video') ? url : false

/**
* Rules.
Expand Down

0 comments on commit a256f0c

Please sign in to comment.