@dhnapi/news-api
Advanced tools
Comparing version 1.0.0--beta-v to 1.0.10--up-v
{ | ||
"name": "@dhnapi/news-api", | ||
"version": "1.0.0--beta-v", | ||
"version": "1.0.10--up-v", | ||
"description": "Simple News-API scrapper library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -6,2 +6,3 @@ ## News-API | ||
@@ Created on 1-12-21 | Dehanjing @@ | ||
+ Updated on 3-12-21 | Dehanjing | ||
``` | ||
@@ -27,7 +28,16 @@ | ||
|----|------|-------------| | ||
| 1 | CNN | Get news on [CNN ID](https://www.cnnindonesia.com/) | | ||
| 2 | BBC | Get news on [BBC ID](https://www.bbc.com/indonesia) | | ||
| 1 | Antara | Get news on [Antara](https://m.antaranews.com/terkini) | | ||
| 2 | BBC | Get news on [BBC](https://www.bbc.com/indonesia) | | ||
| 3 | CNBC | Get news on [CNBC](https://www.cnbcindonesia.com/news/) | | ||
| 4 | CNN | Get news on [CNN](https://www.cnnindonesia.com/) | | ||
| 5 | Daily | Get news on [Daily](https://www.dailynewsindonesia.com/rubrik/news/) | | ||
| 6 | Detik | Get news on [Detik](https://www.detik.com/terpopuler/) | | ||
| 7 | Fajar | Get news on [Fajar](https://fajar.co.id/category/nasional/) | | ||
| 8 | IDN | Get news on [IDN](https://www.idntimes.com/news/) | | ||
| 9 | Indozone | Get news on [Indozone](https://www.indozone.id/index/) | | ||
| 10 | INews | Get news on [INews](https://www.inews.id/news/) | | ||
| 11 | Kompas | Get news on [Kompas](https://news.kompas.com/) | | ||
| 12 | Kontan | Get news on [Kontan](https://www.kontan.co.id/) | | ||
## Examples | ||
## Example | ||
@@ -39,2 +49,5 @@ ```javascript | ||
// @return {Object} class | ||
// console.log(dapi); | ||
/** | ||
@@ -51,3 +64,3 @@ * | ||
/** | ||
* @return response {Object} | ||
* @return {Object} response | ||
* @object AxiosResponse | ||
@@ -66,2 +79,4 @@ **/ | ||
- please add issue if you having problem with installation | ||
! github: https://github.com/Dehanjing/news-api | ||
``` |
const fs = require("fs"); | ||
let __dir = process.cwd(); | ||
let path = require("path"); | ||
@@ -21,3 +21,3 @@ class NewsApi { | ||
}; | ||
fs.readdirSync("./src/lib/").forEach((plugins) => { | ||
fs.readdirSync(__dirname + "/lib/").forEach((plugins) => { | ||
let plugins_ = require("./lib/" + plugins); | ||
@@ -24,0 +24,0 @@ this[plugins.split(".js").shift()] = plugins_; |
@@ -9,5 +9,5 @@ module.exports = function(fn) { | ||
hasil.push({ | ||
berita: $(this).find("p").text().trim(), | ||
berita_url: "https://www.bbc.com" + $(this).find("a").attr("href"), | ||
berita_diupload: $(this).find("time").text().trim(), | ||
title: $(this).find("p").text().trim(), | ||
news_url: "https://www.bbc.com" + $(this).find("a").attr("href"), | ||
upload_date: $(this).find("time").text().trim(), | ||
}); | ||
@@ -18,4 +18,4 @@ }); | ||
result: hasil.filter(({ | ||
berita, berita_diupload | ||
}) => (berita && berita_diupload)) | ||
title, upload_date | ||
}) => (title && upload_date)) | ||
}; | ||
@@ -22,0 +22,0 @@ fn(response, null); |
@@ -9,6 +9,6 @@ module.exports = function(fn) { | ||
hasil.push({ | ||
berita: $(this).find('h4').text().trim(), | ||
berita_url: $(this).find('a').attr('href'), | ||
berita_diupload: $(this).find('span.date').text().trim(), | ||
berita_thumb: $(this).find('img').attr('src'), | ||
title: $(this).find('h4').text().trim(), | ||
news_url: $(this).find('a').attr('href'), | ||
upload_date: $(this).find('span.date').text().trim(), | ||
thumbnail: $(this).find('img').attr('src'), | ||
}); | ||
@@ -19,4 +19,4 @@ }); | ||
result: hasil.filter(({ | ||
berita, berita_diupload | ||
}) => (berita && berita_diupload)) | ||
title, upload_date | ||
}) => (title && upload_date)) | ||
}; | ||
@@ -23,0 +23,0 @@ fn(response, null); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14653
16
327
77
1