Skip to content

Commit f769532

Browse files
authored
Merge pull request #726 from microlinkhq/logo-faicon
fix(metascraper-logo-favicon): use normalized URL
2 parents 7a504f7 + 6ee2c66 commit f769532

File tree

33 files changed

+12835
-6436
lines changed

33 files changed

+12835
-6436
lines changed

packages/metascraper-logo-favicon/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const getDomNodeSizes = (domNodes, attr, url) =>
7878
{
7979
...domNode.attribs,
8080
url: normalizedUrl,
81-
size: getSize(url, domNode.attribs.sizes)
81+
size: getSize(normalizedUrl, domNode.attribs.sizes)
8282
}
8383
]
8484
}, [])

packages/metascraper-logo-favicon/test/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ test('get the biggest icon possible', async t => {
8585
t.is(metadata.logo, 'https://cdn.microlink.io/logo/favicon-196x196.png')
8686
})
8787

88+
test('get the biggest respecting the format', async t => {
89+
const url = 'https://github.com'
90+
const metascraper = createMetascraper()
91+
const html = createHtml([
92+
'<link rel="icon" type="image/png" href="/fluidicon.png" sizes="96x96">',
93+
'<link rel="icon" type="image/x-icon" href="/favicon.ico" sizes="128x128">'
94+
])
95+
const metadata = await metascraper({ url, html })
96+
t.is(metadata.logo, 'https://github.com/fluidicon.png')
97+
})
98+
8899
test('detect `rel="fluid-icon"`', async t => {
89100
const url = 'https://github.com'
90101
const metascraper = createMetascraper()

packages/metascraper-soundcloud/test/snapshots/index.js.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Generated by [AVA](https://avajs.dev).
1414
description: 'Thanks for 5.000 likes on https://www.facebook.com/BeautyBrainMusic :D <3 <3 <3',
1515
image: 'https://i1.sndcdn.com/artworks-000069142357-nwttc6-t500x500.jpg',
1616
lang: 'en',
17-
logo: 'https://a-v2.sndcdn.com/assets/images/sc-icons/favicon-2cadd14bdb.ico',
17+
logo: 'https://a-v2.sndcdn.com/assets/images/sc-icons/ios-a62dfc8fe7.png',
1818
publisher: 'SoundCloud',
1919
title: 'Swag Bandicoot [FREE DOWNLOAD]',
2020
url: 'https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot',
Binary file not shown.

packages/metascraper/test/integration/arstechnica/input.html

+2,491-528
Large diffs are not rendered by default.

packages/metascraper/test/integration/arstechnica/snapshots/index.js.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Generated by [AVA](https://avajs.dev).
1010
1111
{
1212
audio: null,
13-
author: 'Chris Stokel-Walker',
14-
date: '2017-06-11T14:00:33.000Z',
13+
author: 'Ars Staff',
14+
date: '2017-06-11T14:11:02.000Z',
1515
description: 'For original YouTubers, their online haven became a media behemoth—but they keep vlogging.',
16-
image: 'https://cdn.arstechnica.net/wp-content/uploads/2017/06/Screen-Shot-2017-06-08-at-1.32.44-PM-760x380.png',
16+
image: 'https://cdn.arstechnica.net/wp-content/uploads/2017/06/Screen-Shot-2017-06-08-at-1.32.44-PM.png',
1717
lang: 'en',
18-
logo: 'https://cdn.arstechnica.net/wp-content/themes/ars/assets/img/material-ars-db41652381.png',
18+
logo: 'https://cdn.arstechnica.net/wp-content/uploads/2016/10/cropped-ars-logo-512_480.png',
1919
publisher: 'Ars Technica',
2020
title: 'More than a decade later, how do original YouTube stars feel about the site?',
2121
url: 'https://arstechnica.com/features/2017/06/youtube-changed-my-life-a-pair-of-original-videostars-ponder-a-life-lived-online/',
Binary file not shown.

packages/metascraper/test/integration/cio/snapshots/index.js.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Generated by [AVA](https://avajs.dev).
1515
description: 'If IT is going to better align themselves with business operations, they must be able to objectively quantify the value of the cloud.',
1616
image: 'http://images.techhive.com/images/article/2015/06/msftone_cloudperspective4-100588855-primary.idge.png',
1717
lang: 'en',
18-
logo: 'https://idge.staticworld.net/cio/CIO_logo_144x144.png',
18+
logo: 'https://idge.staticworld.net/cio/CIO_logo_300x300.png',
1919
publisher: 'CIO',
2020
title: '20 Ways to Measure the Success of Your Growing Cloud Investment',
2121
url: 'http://www.cio.com/article/2929788/cloud-computing/20-ways-to-measure-the-success-of-your-growing-cloud-investment.html',
Binary file not shown.

packages/metascraper/test/integration/computerworld/snapshots/index.js.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Generated by [AVA](https://avajs.dev).
1515
description: 'My healthcare data is what I want protected the most (intimate details about my family’s health, where we live, and financial information). Anything and everything a hacker could want! It is safe? As a data security professional and citizen, I know the answer is not good.',
1616
image: 'http://images.techhive.com/images/article/2016/04/blog-31_apr15_image-1-100656409-primary.idge.jpg',
1717
lang: 'en',
18-
logo: 'https://idge.staticworld.net/ctw/computerworld-logo144x144.png',
18+
logo: 'https://idge.staticworld.net/ctw/computerworld-logo300x300.png',
1919
publisher: 'Computerworld',
2020
title: 'Healthcare Data Protection and Privacy Prognosis—Still Critical but New Treatment is Available',
2121
url: 'http://www.computerworld.com/article/3057179/data-analytics/healthcare-data-protection-and-privacy-prognosis-still-critical-but-new-treatment-is-available.html',
Binary file not shown.

packages/metascraper/test/integration/health/index.js

-31
This file was deleted.

0 commit comments

Comments
 (0)