Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/enums/ua-parser-enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ const Extension = Object.freeze({
GOOGLE_OTHER_VIDEO: 'GoogleOther-Video',
GOOGLE_SAFETY: 'Google-Safety',
GOOGLE_STOREBOT: 'Storebot-Google',
HEADLINE: 'Headline',
HIVE_IMAGESIFTBOT: 'ImagesiftBot',
HUAWEI_PANGUBOT: 'PanguBot',
HUAWEI_PETALBOT: 'PetalBot',
Expand Down
6 changes: 6 additions & 0 deletions src/extensions/ua-parser-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ const Crawlers = Object.freeze({
],
[NAME, VERSION, [TYPE, CRAWLER]],

[
// Headline - https://headline.com/legal/crawler
/(ev-crawler)\/([\w\.]+)/i
],
[[NAME, 'Headline'], VERSION, [TYPE, CRAWLER]],

[
// YandexBot MirrorDetector
/(yandexbot\/([\w\.]+); mirrordetector)/i
Expand Down
10 changes: 10 additions & 0 deletions test/data/ua/extension/crawler.json
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,16 @@
"type" : "crawler"
}
},
{
"desc" : "Headline",
"ua" : "Mozilla/5.0 (compatible; ev-crawler/1.0; +https://headline.com/legal/crawler)",
"expect" :
{
"name" : "Headline",
"version" : "1.0",
"type" : "crawler"
}
},
{
"desc" : "HuggingFace-Bot",
"ua" : "Mozilla/5.0 (compatible; HuggingFace-Bot/1.0; +https://huggingface.co/)",
Expand Down
2 changes: 2 additions & 0 deletions test/unit/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ describe('isBot', () => {
const firefox = 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0';
const scrapy = 'Scrapy/1.5.0 (+https://scrapy.org)';
const thunderbird = 'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0';
const headline = 'Mozilla/5.0 (compatible; ev-crawler/1.0; +https://headline.com/legal/crawler)';

const botParser = new UAParser(firefox, { Bots, Emails });
assert.equal(isBot(botParser.getResult()), false);
assert.equal(isBot(botParser.setUA(ahrefsBot).getResult()), true);
assert.equal(isBot(botParser.setUA(scrapy).getResult()), true);
assert.equal(isBot(botParser.setUA(thunderbird).getResult()), false);
assert.equal(isBot(botParser.setUA(headline).getResult()), true);

assert.equal(isBot(ahrefsBot), true);
assert.equal(isBot(firefox), false);
Expand Down