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

hamro-patro-scraper

v1.1.5

Published

A package to scrape Nepali date, time, daily horoscope, gold and silver rates and exchange rates from Hamro Patro.

Downloads

86

Readme

hamro-patro-scraper

hamro-patro-scraper is an npm package for scraping Nepali date, time, daily horoscope, gold prices, and exchange rates from Hamro Patro. It provides a simple API for retrieving this information programmatically or via a command-line interface.

Installation

You can install hamro-patro-scraper globally to use the CLI or as a dependency in your Node.js project.

Install Globally

To install hamro-patro-scraper globally, use:

npm install -g hamro-patro-scraper

Install as a Dependency

To add hamro-patro-scraper to your project, run:

npm install hamro-patro-scraper

Usage

Command-Line Interface (CLI)

Once installed globally, you can use the CLI to fetch Nepali date/time, daily horoscope, gold prices, and exchange rates.

  • Fetch Nepali Date and Time:

    HamroPatro datetime
  • Fetch Daily Horoscope:

    HamroPatro horoscope
  • Fetch Gold Prices:

    HamroPatro gold
  • Fetch Exchange Rates:

    HamroPatro forex

Using in Node.js Code

You can also use hamro-patro-scraper in your Node.js applications. Here’s how:

  1. Require the Package:

    const { hamroPatro, getHoroscope, getGoldPrices, getExchangeRates } = require('hamro-patro-scraper');
  2. Fetch Nepali Date and Time:

    (async () => {
      try {
        const dateTime = await hamroPatro();
        console.log('Nepali Date and Time:', dateTime);
      } catch (error) {
        console.error('Error fetching Nepali date and time:', error.message);
      }
    })();
  3. Fetch Daily Horoscope:

    (async () => {
      try {
        const horoscope = await getHoroscope();
        console.log('Daily Horoscope:', horoscope);
      } catch (error) {
        console.error('Error fetching daily horoscope:', error.message);
      }
    })();
  4. Fetch Gold Prices:

  (async () => {
    try {
      const data = await getGoldPrices();
      console.log(JSON.stringify(data, null, 2));
    } catch (error) {
      console.error('Error fetching gold prices:', error.message);
    }
  })();
  1. Fetch Exchange Rates:
 (async () => {
try {
  const data = await getExchangeRates();
  console.log(JSON.stringify(data, null, 2));
} catch (error) {
  console.error('Error fetching exchange rates:', error.message);
}
})();

API

hamroPatro()

Returns an object with the following properties:

  • nepaliDate: The current Nepali date.
  • currentTime: The current time in Nepali time.
  • englishDate: The current date in the Gregorian calendar.

getHoroscope()

Returns an array of horoscope objects with the following properties for each rashi (zodiac sign):

  • rashi: The index of the rashi (1-12).
  • name: The Nepali name of the rashi.
  • text: The horoscope description for the rashi.

getGoldPrices()

Logs the gold and silver prices directly to the console.

getExchangeRates()

Logs the exchange rates directly to the console.

License

This package is licensed under the Apache License 2.0.

Contributing

If you'd like to contribute to hamro-patro-scraper, please fork the repository and submit a pull request. Contributions, bug reports, and feature requests are welcome!

Contact

For any questions or issues, please open an issue on the GitHub repository.


hamro-patro-scraper is maintained by Milan Bhandari.