Giter Club home page Giter Club logo

serverless-web-differ's Introduction

Serverless Web Differ

A serverless web browser which crawls websites and compares pages by schedule, with Serverless, AWS Lambda, Headless Chrome and Selenium!

What it can do | Prerequisites | Configuration | Deploy

What it can do

  • Runs headless chrome in a serverless environement.
  • Finds web elements with xpath and compares it.
  • Send notifications/emails if something has changed.

Prerequisites

  1. You need to have a aws account, aws_access_key_id and aws_secret_access_key. If you don't an account yet, go to here to sign up for one, and then follow the instructions here to get the key_id and access key.
  2. Install node and make sure npm is available in your path.
  3. Install docker from here.
  4. Install Serverless: npm install -g serverless
  5. Configure serverless with aws, using the aws_access_key_id and aws_secret_access_key from step 0: sls config credentials -p aws -k aws_access_key_id -s aws_secret_access_key
  6. Clone this project: git clone https://github.com/LeiShi1313/serverless-web-differ.git
  7. Install the dependencies: cd serverless-web-differ && npm install

Configuration

There are couple of things you need to configure before actually make the function running in the cloud. First you need to create a file called config.yml and copy/paste everything from config.yml.example. Inside the config.yml:

  • events: This is the place you can define what is the frequency the function runs, you can read more from here. But most of the time, you want one entry like - schedule: rate(1 hour) or - schedule: cron(0 * * * ? *), which both means run the function every hour.
  • server_chan/sendgrid/ifttt: There are the pre-defined ways to notify you if something has changed on the websites you interested. You can read the comments to find out how to get the security keys.
  • websites: This is the main configuration part. websites can have multiple entries, and each one represents a website you want to periodically check. url and xpath is easy to understand, if you don't know how to get the xpath, try search xpath [THE BROWSER YOU ARE USING], you should be able to find a lot of informations. For original, actually it can be absent if you are expecting a web element will appear, otherwise the function will compare the EXACT text from original and the web element of the web page by xpath.

Deploy

This is simple, when everything is all set, run:

sls deploy

and ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

TODO

  • Add Chinese ver. README.
  • For each website, deploy a lambda function instead of visiting all websites in one function.
  • Make notify.py another lambda function.
  • Add more ways to notify.
  • Maybe move notify.py to another project and make a submodule here?
  • Provide a headerless chrome docker image
  • Options for other cloud provider: Google Cloud, Aliyun, etc

serverless-web-differ's People

Contributors

leishi1313 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.