Giter VIP home page Giter VIP logo

web-scraping-project's Introduction

Automating WebScraping using Cloud Run

A demonstration on how to use Python to automate the process of getting the latest camera’s prices from Moment website by using Cloud Run.

Cloud Run is a managed compute platform that enables you to run containers that are invocable via requests or events. Cloud Run is serverless.

How it work

Every day at 9am Cloud Scheduler will send a HTTP POST request to Cloud Run, Cloud Run will start the automation by referencing the step in Dockerfile. The Dockerfile will create a docker container with:

  1. Python 3.8 image
  2. Manually install all the missing libraries
  3. Install Chrome
  4. Install Python dependencies
  5. Copy local code to container image
  6. Run the web server on container startup
  7. Once the container has successfully been built, it will run the main.py file.

Main.py file will create a server using Python Flask. Cloud Run will start the process by POST to the main function.

The process will:

  1. Access Google Spreadsheet
  2. Create a chrome web driver
  3. Go to moment website
  4. Auto-scrolling with Selenium
  5. Get the website HTML with BeautifulSoup
  6. Extract the selected data
  7. Save it in Google Spreadsheet
  8. Get the formatted data from Google Spreadsheet
  9. Send a message to Telegram using Telegram API and webhook

Once all the process had been successfully ended. Cloud Run will stop the container.

Technologies Stack

  1. Python
  2. Selenium
  3. Flask
  4. BeautifulSoup
  5. Requests
  6. Google Spreadsheet
  7. Google Cloud Run

web-scraping-project's People

Contributors

zhenyang0405 avatar

Stargazers

Nick Lojecico avatar Niccolo Salvini avatar  avatar  avatar Asah Lesley avatar Gustavo Juantorena avatar Alex Paul  avatar M. Aji Prasetyo avatar  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.