npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ariya/penjabarberita

v1.0.6

Published

Extract the article list from its raw news HTML

Downloads

17

Readme

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.