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

blogsearch-crawler

v0.0.4

Published

BlogSearch index building tool for generic static webpages (crawler)

Downloads

1

Readme

BlogSearch index building tool for generic static webpages (crawler)

// Asciidoc references // Documentation: https://asciidoctor.org/docs/user-manual/ // Quick reference: https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/ // Asciidoc vs Markdown: https://asciidoctor.org/docs/user-manual/#comparison-by-example // GitHub Flavored Asciidoc (GFA): https://gist.github.com/dcode/0cfbf2699a1fe9b46ff04c41721dda74

:project-version: 0.0.3 :rootdir: https://github.com/kbumsik/blogsearch

ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: :important-caption: :heavy_exclamation_mark: :caution-caption: :fire: :warning-caption: :warning: endif::[]

CAUTION: This is a part of link:{rootdir}[BlogSearch project]. If you would like to know the overall concept, go to link:{rootdir}[the parent directory].

1. Building a search index file

The easiest way

[source,bash] npx blogsearch-crawler

The formal way

[source,bash]

npm install -g blogsearch-crawler blogsearch-crawler

Configuration

CAUTION: Go to link:{rootdir}#whats-in-the-index[the "What's in the index file" section of the main project]. For more details on how to configure fields.

.blogsearch.config.js [source,javascript,options="nowrap",subs="verbatim,attributes"]

module.exports = { // [Mandatory] This must be 'simple'. type: 'simple', // [Mandatory] Generated blogsearch database file. output: './my_blog_index.db.wasm', // [Mandatory] List of entries to parse. The crawler uses glob pattern internally. // How to use glob: https://github.com/isaacs/node-glob entries: [ './reactjs.org/public/docs/**/*.html' ], // [Mandatory] Fields configurations. // See: {rootdir}#whats-in-the-index fields: { title: { // The value can be a CSS selector. parser: 'article > header', }, body: { // Set false if you want to reduce the size of the database. hasContent: true, // It can be a function as well. parser: (entry, page) => { // Use puppeteer page object. // It's okay to return a promise. return page.$eval('article > div > div:first-child', el => el.textContent); } }, url: { // By setting this false the search engine won't index the URL. indexed: false, parser: (entry, page) => { // entry is a string of the path being parsed. return entry.replace('./reactjs.org/public', 'https://reactjs.org'); }, }, categories: { // This is disabled because the target website doesn't have categories. enabled: false, // This is a dummy parser. This is unused because the field is disabled. parser: () => 'categories-1, categories-2', }, tags: { // This is disabled because the target website doesn't have tags. enabled: false, // This is a dummy parser. This is unused because the field is disabled. parser: () => 'tags-1, tags-2', }, } };

2. Enabling the search engine in the webpage

You need to enable the search engine in the web page. Go to link:../blogsearch[blogsearch Engine].

Again, if you would like to understand the concept of BlogSearch, go to link:{rootdir}/[the parent directory].