Socket
Socket
Sign inDemoInstall

@ariya/penjabarberita

Package Overview
Dependencies
15
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ariya/penjabarberita

Extract the article list from its raw news HTML


Version published
Weekly downloads
2
Maintainers
1
Install size
2.53 MB
Created
Weekly downloads
 

Readme

Source

Penjabar Berita

npm (scoped) GitHub license Tests

Bahasa Indonesia | English


Bahasa Indonesia

Penjabar Berita: Pustaka JavaScript untuk Node.js (@ariya/penjabarberita) guna mendapatkan daftar artikel (judul, tautan, waktu) dari berkas HTML yang mewakili indeks berita tersebut.

Penjabar Berita dikhususkan untuk mengolah surat kabar daring Indonesia. Saat ini, yang bisa diproses adalah indeks berita dari Antara, BBC Indonesia, CNBC Indonesia, CNN Indonesia, Intisari, Jawa Pos, Kompas, Kontan, Liputan 6, Pikiran Rakyat, Republika, Suara, Tempo, The Conversations, TurnBackHoax, Viva News.

Instalasi: npm install @ariya/penjabarberita.

Misalkan berkas data.html didapatkan dengan mengambil indeks berita dari laman surat kabar Kompas, katakanlah menggunakan cURL dengan langkah curl -o data.html https://www.kompas.com/tag/virus-corona, maka berkas tersebut bisa diproses seperti di bawah ini:

const fs = require('fs');
const penjabarberita = require('@ariya/penjabarberita');

const buffer = fs.readFileSync('data.html', 'utf-8');
const list = penjabarberita(buffer.toString());
console.log(list.map(n => n.title));

yang akan menghasilkan keluaran seperti:

[
  'Pentingnya Meningkatkan Sistem Kekebalan Tubuh dengan Vitamin',
  'Bisakah Virus Corona Bertahan di Rambut Manusia?',
  // dst...
]

Di samping judul artikel (title), bisa juga didapatkan tautan (url) dan tanggal/waktu (timestamp, sebagai Unix epoch).


English

Penjabar Berita: A JavaScript library for Node.js (@ariya/penjabarberita) to extract the article list (title, link, timestamp) from its HTML representation.

Penjabar Berita is geared towards processing the article index of online news sites in Indonesia, currently supporting Antara, BBC Indonesia, CNBC Indonesia, CNN Indonesia, Intisari, Jawa Pos, Kompas, Kontan, Liputan 6, Pikiran Rakyat, Republika, Suara, Tempo, The Conversations, TurnBackHoax, Viva News.

Installation: npm install @ariya/penjabarberita.

Assuming data.html is obtained by retrieving the news index from Kompas, for instance (by using cURL) curl -o data.html https://www.kompas.com/tag/virus-corona, then the file can be processed as follows:

const fs = require('fs');
const penjabarberita = require('@ariya/penjabarberita');

const buffer = fs.readFileSync('data.html', 'utf-8');
const list = penjabarberita(buffer.toString());
console.log(list.map(n => n.title));

which will result in:

[
  'Pentingnya Meningkatkan Sistem Kekebalan Tubuh dengan Vitamin',
  'Bisakah Virus Corona Bertahan di Rambut Manusia?',
  // and so on...
]

In addition to the article title (title), the article link (url) and published date/time (timestamp, as Unix epoch) are available as well.

Keywords

FAQs

Last updated on 15 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc