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.
You can install hamro-patro-scraper
globally to use the CLI or as a dependency in your Node.js project.
To install hamro-patro-scraper
globally, use:
npm install -g hamro-patro-scraper
To add hamro-patro-scraper
to your project, run:
npm install hamro-patro-scraper
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
You can also use hamro-patro-scraper
in your Node.js applications. Here’s how:
-
Require the Package:
const { hamroPatro, getHoroscope, getGoldPrices, getExchangeRates } = require('hamro-patro-scraper');
-
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); } })();
-
Fetch Daily Horoscope:
(async () => { try { const horoscope = await getHoroscope(); console.log('Daily Horoscope:', horoscope); } catch (error) { console.error('Error fetching daily horoscope:', error.message); } })();
-
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);
}
})();
- 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);
}
})();
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.
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.
Logs the gold and silver prices directly to the console.
Logs the exchange rates directly to the console.
This package is licensed under the Apache License 2.0.
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!
For any questions or issues, please open an issue on the GitHub repository.
hamro-patro-scraper is maintained by Milan Bhandari.