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

mpo-project

v1.0.0

Published

# Google Calendar Event Generator for MPO Krakow Rubbish Retrieval Plan

Downloads

2

Readme

README.md

Google Calendar Event Generator for MPO Krakow Rubbish Retrieval Plan

This NodeJS application allows you to generate Google Calendar events for rubbish retrieval based on the schedule provided by MPO Krakow. The schedule is fetched from MPO Krakow's address search using the streetId and houseId parameters.

Description

The application retrieves the rubbish retrieval plan for your house from MPO Krakow and creates events in your Google Calendar. This ensures you never miss a rubbish collection day.

The retrieval plan is accessed via a POST request to the MPO Krakow API, which returns a PNG image containing the schedule. The application parses this image to extract the schedule and then creates corresponding events in your Google Calendar.

Prerequisites

  • NodeJS installed on your machine.
  • Google API credentials.
  • MPO token, street ID, and house ID.

Configuration Files

1. credentials.json

This file contains your Google API credentials. You need to obtain this file by following these steps:

  1. Go to the Google Cloud Console.
  2. Create a new project or select an existing project.
  3. Navigate to the "Credentials" section.
  4. Click on "Create Credentials" and select "OAuth 2.0 Client IDs".
  5. Download the credentials.json file and place it in the root directory of your project.

2. token.json

This file stores the OAuth 2.0 tokens. It will be automatically generated when you authorize the application for the first time. You do not need to create this file manually.

3. mpo.json

This file contains the necessary configuration for both MPO and Google Calendar integration. Create a file named mpo.json in the root directory of your project with the following structure:

{
  "mpo": {
    "token": "fill_from_website",
    "streetId": "fill_your_own",
    "houseId": "fill_your_own"
  },
  "google": {
    "tokenPath": "./token.json",
    "credentialsPath": "./credentials.json",
    "scopes": ["https://www.googleapis.com/auth/calendar"],
    "calendar": {
      "name": "Prywatne",
      "guests": ["[email protected]"]
    }
  }
}

Configuration Details:

  • mpo.token: The token obtained from the MPO website.
  • mpo.streetId: Your street ID.
  • mpo.houseId: Your house ID.
  • google.tokenPath: Path to the token.json file.
  • google.credentialsPath: Path to the credentials.json file.
  • google.scopes: Scopes required for the Google Calendar API.
  • google.calendar.name: Name of the calendar.
  • google.calendar.guests: List of guest email addresses to invite.

Usage

  1. Clone the repository and navigate to the project directory.
  2. Install the dependencies:
    npm install
  3. Ensure the credentials.json and mpo.json files are in the root directory.
  4. Run the application:
    node app.js

The application will guide you through the OAuth2.0 authorization process.

Example API Request

To fetch the rubbish retrieval plan, the application sends a POST request to the following endpoint:

curl 'https://kiedywywoz.pl/API/harmo_img/' \
  -H 'accept: */*' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'dnt: 1' \
  -H 'origin: https://harmonogram.mpo.krakow.pl' \
  -H 'pragma: no-cache' \
  -H 'priority: u=1, I' \
  -H 'referer: https://harmonogram.mpo.krakow.pl/' \
  -H 'sec-ch-ua: "Chromium";v="125", "Not.A/Brand";v="24"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: cross-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' \
  --data-raw 'ulica=39130&numer=684796&token=OkkxhC6b9etJBAq7WTHJ0LhIglO18sip'

Replace the placeholders in the data with your actual streetId, houseId, and token from the MPO website.