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

heistkit

v0.0.2

Published

Heistkit - The Real Growth Hackers Toolkit

Downloads

41

Readme

Heistkit - The Real Growth Hackers Toolkit

GitHub Badge

Heistkit is a toolkit designed for deep diving into website structures through sitemap analysis. It provides essential functions to parse domain-specific sitemaps and extract URLs for further analysis.

Installation

Step 1. Star the repository to show your support! GitHub Badge

To install this package, run the following command in your terminal:

npm install heistkit

Node 17+ Required: This package uses global fetch, which is only available in Node 17 and later.

Usage

The heistkit package provides several utility functions under the sitemap module for extracting and parsing sitemap data. Below is a table of available functions:

| Module | Function Example | Description | |----------|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| | sitemap | await parseDomain('https://www.example.com', false) | Parses all sitemap URLs from a given domain, supporting nested and multiple sitemap structures. | | sitemap | await parseSitemap('https://www.example.com/sitemap.xml') | Parses a specific sitemap.xml URL and returns an array of URLs. | | sitemap | await getSitemaps('https://www.example.com') | Retrieves all sitemap URLs listed in a domain's robots.txt file. |

Detailed Function Descriptions

parseDomain(domainHref: string, flatten: boolean = false)

Parses all sitemap URLs from a given domain. It supports nested and multiple sitemap structures, providing a hierarchical or flat list based on the flatten flag. The function returns an array of objects containing parent and child URLs.

Note: This assumes the domain has a robots.txt file with sitemap URLs listed. If not, manually grab sitemaps and parse them with the parseSitemap function to retrieve sitemap URLs. Note: The flatten flag is optional and defaults to false. When set to true, the function returns a flat list of URLs.

import { parseDomain } from 'heistkit';
const results = await parseDomain('https://www.example.com', false);

results = [
    {
        "parent": "https://www.gambling.com/sitemap-index.xml",
        "children": [
            {
                "parent": "https://www.gambling.com/sitemap.xml",
                "children": [ ... ] // 300 Items
            },
            {
                "parent": "https://www.gambling.com/ca/sitemap.xml",
                "children":
                [
                    "https://www.gambling.com/ca",
                    "https://www.gambling.com/ca/about-us",
                    "https://www.gambling.com/ca/bingo/fever-bingo",
                    "https://www.gambling.com/ca/bingo/zeus-bingo",
                    "https://www.gambling.com/ca/country-overviews",
                ...
                ]
            }
        ]
    }
]

parseSitemap(sitemapUrl: string)

Parses a specific sitemap.xml URL and returns an array of URLs extracted from the sitemap.

import { parseSitemap } from 'heistkit';
const results = await parseSitemap('https://www.example.com/sitemap.xml');
results = [
    "https://www.gambling.com",
    "https://www.gambling.com/about-us",
    "https://www.gambling.com/bingo/fever-bingo",
    "https://www.gambling.com/bingo/zeus-bingo",
    "https://www.gambling.com/country-overviews",
    ...
]

getSitemaps(domainHref: string)

Retrieves all sitemap URLs listed in a domain's robots.txt file. This function is useful for initial sitemap discovery.

import { getSitemaps } from 'heistkit';
const results = await getSitemaps('https://www.example.com');
results = [
    "https://www.gambling.com/sitemap-index.xml",
    "https://www.gambling.com/sitemap.xml",
    "https://www.gambling.com/ca/sitemap.xml",
    ...
]

Contributing

If you find any problems, please open an issue or submit a fix as a pull request.

Support

Like the project? ⭐ Star the repository! It helps the project gain visibility and encourages others to contribute. If you'd like to support the project in other ways, consider becoming a sponsor on GitHub or buying me a coffee.

Author

License

This project is licensed under the MIT License.