Skip to content

A node JS application that scraps blogs off a blog and sends them to a Telegram bot.

License

Notifications You must be signed in to change notification settings

lewis-munyi/javascript-web-scraper

Repository files navigation

Bikozulu Bot

A Node.js application that scraps posts off of Bikozulu's blog and sends them to users subscribed to a Telegram bot.

Buy Me A Coffee

Table of contents

Bikozulu Bot

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You will need these to run and set up the app

  • A firebase account.
  • Node.js installed on your PC

Installing

  1. Clone or download the repo from this url and extract it.

  2. Open your console and change into that directory

    cd javascript-web-scraper/
    
  3. List the contents of the directory.

    ls
    
  4. You should have such a directory structure

    javascript-web-scraper/
    └── functions/
    │   ├── index.js
    │   │── ...
    │   │── ...
    │   └── package.json
    |── firebase.json           
    |── .gitignore
    |── firestore.rules           
    |── ...
    |── ...     
    |── index.js
    └── package.json
    
  5. Install the required modules

    npm install
    
  6. Install the required modules for cloud functions

    cd functions/
    npm install 
    
  7. Create a .env file at the root of your directory and add the following variables:

     API_KEY: "",
     AUTH_DOMAIN: "",
     DATABASE_URL: "",
     PROJECT_ID: "",
     STORAGE_BUCKET: "",
     MESSAGING_SENDING_ID: "",
     APP_ID: "",
     MEASUREMENT_ID: ""
    
  8. Sign into your console and open the app you created. Get the config object for your web app and copy-paste the details into the respective fields in yout .env file. Follow this tutorial if you have trouble getting them.

  9. Retrieve your Javascript SDK for firebase and copy it to the root of your project. Use this tutorial.

  10. Rename the firebase admin credentials that you have just downloaded to firebase-adminsdk.json

Running the app

The app is split into two parts;

  • A web scraping application that scraps data and stores it in Cloud firestore
  • Cloud functions that are triggered and run when updating the Telegram bot.

Running the web scraper

  1. From the root(/) directory, run
    npm run start
    
  2. You should see such a screen

Logo

Yaay! It works.

Running cloud functions

  1. Navigate into your functions/ directory
    cd functions/
    
  2. Run
    npm run serve
    

That's it

Deployment

  1. cd into the root / directory
    # If you are in the functions directory
    cd ../
    
  2. run
    firebase deploy
    

Built With

Contributing

Currently accepting pull requests.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU General Public License v3.0 License - see the LICENSE file for details

Acknowledgments

Enjoy 🤘

About

A node JS application that scraps blogs off a blog and sends them to a Telegram bot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published