Comparing version 1.0.0 to 1.0.1
@@ -8,2 +8,4 @@ export interface NewsArticle { | ||
publisher: string; | ||
fullCoverage: string; | ||
thumbnailUrl: string | null; | ||
} | ||
@@ -14,5 +16,5 @@ export declare class Gnews { | ||
constructor(defaultParams?: any); | ||
headlines(topic: string, extraParams?: any): Promise<NewsArticle[]>; | ||
headlines(topic?: string, extraParams?: any): Promise<NewsArticle[]>; | ||
search(q: string, extraParams?: any): Promise<NewsArticle[]>; | ||
private request(url, extraParams?); | ||
} |
@@ -32,6 +32,8 @@ "use strict"; | ||
const publisher = entities.decode($('font').html() || ''); | ||
const fullCoverage = $('ol > a').attr('href'); | ||
// Add publisher, re-formatted description, and url | ||
const formattedArticle = Object.assign(article, { | ||
description: decodedDescription, | ||
publisher | ||
publisher, | ||
fullCoverage | ||
}); | ||
@@ -38,0 +40,0 @@ // omit imgSrc if empty |
{ | ||
"name": "node-gnews", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A simple node module that loads articles from Google News", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/shumbo/node-gnews" | ||
}, | ||
"main": "dist/index.js", | ||
@@ -10,3 +14,3 @@ "types": "dist/index.d.ts", | ||
"prepublishOnly": "npm run lint && npm test", | ||
"prepare":"npm run build", | ||
"prepare": "npm run build", | ||
"build": "tsc --project ./tsconfig.json", | ||
@@ -13,0 +17,0 @@ "lint": "tslint -c tslint.json 'src/**/*.ts'" |
@@ -104,3 +104,4 @@ # node-gnews | ||
|publisher|Publisher of the article|EW.com| | ||
|fullCoverage|Link to the Google News Related Stories|https://news.google.com/story/dOHKnaQodeaDspMmZOqoGu4YGQ47M?hl=en&ned=us (expired)| | ||
|thumbnailUrl|Thumbnail image url. **Omitted when not available.**|https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSzlMagnYwijdaLtdc4MWJopShsC9vRGDh-_LKP9GlJ_ofu6J8OyUFdlebTu4e1JT6mb0_YY7Lw59M| | ||
@@ -14,2 +14,4 @@ import axios from 'axios'; | ||
publisher: string; | ||
fullCoverage: string; | ||
thumbnailUrl: string | null; | ||
} | ||
@@ -46,2 +48,3 @@ | ||
const publisher = entities.decode($('font').html() || ''); | ||
const fullCoverage = $('ol > a').attr('href'); | ||
@@ -51,3 +54,4 @@ // Add publisher, re-formatted description, and url | ||
description: decodedDescription, | ||
publisher | ||
publisher, | ||
fullCoverage | ||
}); | ||
@@ -73,3 +77,3 @@ | ||
} | ||
public headlines(topic: string, extraParams: any = {}) { | ||
public headlines(topic?: string, extraParams: any = {}) { | ||
let url; | ||
@@ -76,0 +80,0 @@ if (topic) { |
@@ -28,3 +28,4 @@ import test from 'ava'; | ||
thumbnailUrl: | ||
'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSStFGoURvbhN2B3uOAMfecR8xA8VPQZeqYVHQU1fet9AuOyvWOAv4qMamS5o94sC7mtt87J6Y6QOw' | ||
'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSStFGoURvbhN2B3uOAMfecR8xA8VPQZeqYVHQU1fet9AuOyvWOAv4qMamS5o94sC7mtt87J6Y6QOw', | ||
fullCoverage: 'https://news.google.com/story/dlsXxqrSy2rUJaMH0ymTb3ve8h_JM?hl=en&ned=us' | ||
}; | ||
@@ -57,3 +58,3 @@ | ||
.decode( | ||
'<table border="0" cellpadding="2" cellspacing="3"><tr><td><img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSWE57yJAuPHskDGwgSGKoUp7QfIbwh5ek8UUwUrGeMLLyXxtHjWJLTHjN_9-A5eDf2AvBS6xHsnQ" border="1"></td><td><ol style="list-style: none; margin: 0; padding: 0;"><strong><li><a href="https://www.forbes.com/sites/kevinmurnane/2017/12/16/the-nintendo-switch-offers-unique-opportunities-for-players-and-developers-alike/" target="_blank">The Nintendo Switch Offers Unique Opportunities For Players And Developers Alike</a>&nbsp;&nbsp;<font color="#6f6f6f">Forbes</font></li></strong><li><a href="https://www.pastemagazine.com/articles/2017/12/what-nintendo-can-teach-us-about-exploration-in-op.html" target="_blank">What Nintendo Can Teach Us About Exploration in Open World Game Design</a>&nbsp;&nbsp;<font color="#6f6f6f">Paste Magazine</font></li><li><a href="https://cogconnected.com/2017/12/yooka-laylee-finally-nintendo-switch/" target="_blank">Yooka-Laylee Finally Out On Nintendo Switch</a>&nbsp;&nbsp;<font color="#6f6f6f">COGconnected</font></li><a href="https://news.google.com/story/dFB9tmCh7NpJnbMrO5E2ANrVmC9PM?hl=en&ned=us" target="_blank">Full coverage</a></ol></td></tr></table>' | ||
'<table border="0" cellpadding="2" cellspacing="3"><tr><td><img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSWE57yJAuPHskDGwgSGKoUp7QfIbwh5ek8UUwUrGeMLLyXxtHjWJLTHjN_9-A5eDf2AvBS6xHsnQ" border="1"></td><td><ol style="list-style: none; margin: 0; padding: 0;"><strong><li><a href="https://www.forbes.com/sites/kevinmurnane/2017/12/16/the-nintendo-switch-offers-unique-opportunities-for-players-and-developers-alike/" target="_blank">The Nintendo Switch Offers Unique Opportunities For Players And Developers Alike</a>&nbsp;&nbsp;<font color="#6f6f6f">Forbes</font></li></strong><li><a href="https://www.pastemagazine.com/articles/2017/12/what-nintendo-can-teach-us-about-exploration-in-op.html" target="_blank">What Nintendo Can Teach Us About Exploration in Open World Game Design</a>&nbsp;&nbsp;<font color="#6f6f6f">Paste Magazine</font></li><li><a href="https://cogconnected.com/2017/12/yooka-laylee-finally-nintendo-switch/" target="_blank">Yooka-Laylee Finally Out On Nintendo Switch</a>&nbsp;&nbsp;<font color="#6f6f6f">COGconnected</font></li><a href="https://news.google.com/story/dFB9tmCh7NpJnbMrO5E2ANrVmC9PM?hl=en&ned=us" target="_blank">Full coverage</a></ol></td></tr></table>' | ||
) | ||
@@ -63,3 +64,4 @@ .replace(/ /g, String.fromCharCode(160)), // non-breaking space | ||
thumbnailUrl: | ||
'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSWE57yJAuPHskDGwgSGKoUp7QfIbwh5ek8UUwUrGeMLLyXxtHjWJLTHjN_9-A5eDf2AvBS6xHsnQ' | ||
'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSWE57yJAuPHskDGwgSGKoUp7QfIbwh5ek8UUwUrGeMLLyXxtHjWJLTHjN_9-A5eDf2AvBS6xHsnQ', | ||
fullCoverage: 'https://news.google.com/story/dFB9tmCh7NpJnbMrO5E2ANrVmC9PM?hl=en&ned=us' | ||
}; | ||
@@ -66,0 +68,0 @@ |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
199340
904
107
2