Comparing version 1.0.2 to 1.0.3
@@ -6,2 +6,3 @@ "use strict"; | ||
const html_entities_1 = require("html-entities"); | ||
const lodash_1 = require("lodash"); | ||
const xml2js = require("xml2js"); | ||
@@ -31,5 +32,5 @@ const parseXml = (xml) => { | ||
const $ = cheerio.load(description); | ||
const thumbnailUrl = $('img', 'tr').attr('src'); | ||
const thumbnailUrl = lodash_1.get(article, '[media:content]["$"]["url"]', null); | ||
const publisher = entities.decode($('font').html() || ''); | ||
const fullCoverage = $('ol > a').attr('href'); | ||
const fullCoverage = $('ol > li > strong > a').attr('href'); | ||
const related = []; | ||
@@ -36,0 +37,0 @@ $('ol > li').each((index, element) => { |
{ | ||
"name": "node-gnews", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A simple node module that loads articles from Google News", | ||
@@ -13,4 +13,4 @@ "repository": { | ||
"test": "ava", | ||
"prepublishOnly": "npm run lint && npm test", | ||
"prepare": "rm -r ./dist || npm run build", | ||
"prepublishOnly": "npm run lint", | ||
"prepare": "npm run build", | ||
"build": "tsc --project ./tsconfig.json", | ||
@@ -22,2 +22,3 @@ "lint": "tslint -c tslint.json 'src/**/*.ts'" | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.121", | ||
"ava": "^0.24.0", | ||
@@ -37,2 +38,3 @@ "nock": "^9.1.4", | ||
"html-entities": "^1.2.1", | ||
"lodash": "^4.17.11", | ||
"striptags": "^3.1.1", | ||
@@ -39,0 +41,0 @@ "xml2js": "^0.4.19" |
import axios from 'axios'; | ||
import * as cheerio from 'cheerio'; | ||
import { AllHtmlEntities } from 'html-entities'; | ||
import * as striptags from 'striptags'; | ||
import { get } from 'lodash'; | ||
import * as xml2js from 'xml2js'; | ||
@@ -36,3 +36,3 @@ | ||
const flattenArticles = (article: any): any => | ||
Object.entries(article).reduce((previous, [key, value]) => { | ||
Object.entries(article).reduce((previous, [key, value]: any[]) => { | ||
if (key === 'guid') { | ||
@@ -52,5 +52,5 @@ return previous; | ||
const $ = cheerio.load(description); | ||
const thumbnailUrl = $('img', 'tr').attr('src'); | ||
const thumbnailUrl = get(article, '[media:content]["$"]["url"]', null); | ||
const publisher = entities.decode($('font').html() || ''); | ||
const fullCoverage = $('ol > a').attr('href'); | ||
const fullCoverage = $('ol > li > strong > a').attr('href'); | ||
@@ -57,0 +57,0 @@ const related: RelatedArticle[] = []; |
@@ -27,4 +27,2 @@ import test from 'ava'; | ||
publisher: 'CNN', | ||
thumbnailUrl: | ||
'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSStFGoURvbhN2B3uOAMfecR8xA8VPQZeqYVHQU1fet9AuOyvWOAv4qMamS5o94sC7mtt87J6Y6QOw', | ||
fullCoverage: | ||
@@ -84,4 +82,2 @@ 'https://news.google.com/story/dlsXxqrSy2rUJaMH0ymTb3ve8h_JM?hl=en&ned=us', | ||
publisher: 'Forbes', | ||
thumbnailUrl: | ||
'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSWE57yJAuPHskDGwgSGKoUp7QfIbwh5ek8UUwUrGeMLLyXxtHjWJLTHjN_9-A5eDf2AvBS6xHsnQ', | ||
fullCoverage: | ||
@@ -88,0 +84,0 @@ 'https://news.google.com/story/dFB9tmCh7NpJnbMrO5E2ANrVmC9PM?hl=en&ned=us', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
202269
10
6
987
+ Addedlodash@^4.17.11
+ Addedlodash@4.17.21(transitive)