Code Monkey home page Code Monkey logo

offerte_supermercato's Introduction

Offerte Supermercati

This project is made to provide supermarket discounts as text messages on Telegram. It uses webscraping tools to search for interesting offers on supermarket web pages.

Currently, only the following supermarkets are considered:

  • Eurospin Trento

Table of Contents

Installation

  1. Clone the repository:
$ git clone https://github.com/ncldlbn/offerte_supermercato.git
$ cd offerte_supermercato
$ pip install -r requirements.txt
  1. In main.py replace:
/path/to/this/repo

with local absolute path like:

/home/folder/offerte_supermercato
  1. In the folder ./data/input/ create new token.txt file containing the telegram token in the first row and the chatID in the second row, like the example below:
123456789:thisisafaketelegrambottoken
987654321

Usage

Run the code as a cron job, for example if you want to run it every day at 1 PM place in the crontab the following line:

0 13 * * * python /home/folder/offerte_supermercato/src/main.py

offerte_supermercato's People

Contributors

ncldlbn avatar

Watchers

 avatar

offerte_supermercato's Issues

Prezzo al kg

Il prezzo al kg deve essere salvato in due campi distinti anziché una singola stringa:

  1. valore numerico del prezzo unitario unit_price.
  2. unità di misura unit (spesso €/kg o €/l).

Modificare funzioni scraping, invia a telegram, salvataggio nel db e tabella db

Poli via Fermi

Aggiungere script python per web scraping, simile a quanto fatto per eurospin

Lista prodotti da tracciare

Creare lista csv con keyword, marca e prezzo unitario massimo e implementare filtri sui prodotti da tracciare

Minor Issues

  • Fix paths (path to this repo + relative paths),
  • Fix structure (web scraping as function for every supermarket)
  • Add comments

Error fixing

File "/home/nicola/Projects/offerte_supermercato/src/WebScraping.py", line 134, in poli
element['Quantità'] = item.find("span", class_="band-volantino-prodotto-quantita").text
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'text'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/nicola/Projects/offerte_supermercato/src/main.py", line 42, in
message("Errore nello scraping del sito Poli")
TypeError: message() missing 1 required positional argument: 'msg'

Aggiornamento giornaliero

Controllare se lo script funziona nel caso in cui venga lanciato una volta al giorno, senza riproporre le stesse offerte già mostrate.

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.