Git Product home page Git Product logo

steam-discussion-scraper's Introduction

Steam Discussion Scraper

This is a Python script that scrapes comments from a Steam discussion thread and sends their content, as plain text, to a Telegram chat. It also stores a hash of each comment, so that the same comment is not sent twice.

This script was created in order to get alerts for free PC games, from this url.

Dependencies

This script requires the following Python libraries:

  • beautifulsoup4
  • requests
  • python-telegram-bot

These can be installed via pip:

pip install -r requirements.txt

Usage

  1. Create a Telegram bot and get its token. You can follow the instructions here to create a new bot and obtain its token.
  2. Add the bot to a Telegram group or channel where you want to receive the comments.
  3. Set the environment variable TELEGRAM_BOT_TOKEN to the token of your bot.
  4. Set the environment variable TELEGRAM_CHAT_ID to the ID of the group or channel where you want to receive the comments. You can find the ID by following the instructions here.
  5. Alternatively, you can /start a conversation with you bot and set TELEGRAM_CHAT_ID to your own user id. You can find your ID by following the instructions here.
  6. Set the environment variable WAIT to the number of minutes to wait between each check for new comments. For example, to wait 5 minutes, set WAIT to 5.
  7. Set the environment variable STEAM_URL to the Steam discussion page.
  8. Run bot.py:
python bot.py

The script will start scraping the comments and sending them to your Telegram group or channel. It will save the current page number to a file (current_page.txt) so that it can resume from where it left off the next time it is run. You can always edit this file if needed.

To stop the script, press Ctrl+C/Cmd-C.

Docker Usage

  1. Build the Docker image:
docker build -t steam-discussion-scraper .
  1. Run the Docker container, setting the environment variables as necessary:
docker run -e TELEGRAM_BOT_TOKEN=<bot_token> -e TELEGRAM_CHAT_ID=<chat_id> -e WAIT=<minutes> -e STEAM_URL=<steam_url> steam-discussion-scraper

License

This script is released under the MIT License.

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.