Skip to content

Scrape lecture page to get assignment url and send updates through telegram bot.

Notifications You must be signed in to change notification settings

HuiGong-dev/text-me-when-there-is-new-homework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

auto-update-assignment

What?

A small piece of code to scrape assignments of lecture Programmierparadigmen and send the updates through Telegram Bot. (Set variable chat_id to send message to your account/ others account/a channel).

Why?

The reasons for this piece of code are:

  • Instead of using official learning platform Ilias, all the assignments of this lecture are updated on this website.
  • I'm too lazy to refresh the page and check if there's new assignment there.
  • It's fun xD

How?

  • scrape the lecture page and get the html content.
  • find the assignment table and get all assignment URLs.
  • compare with the result of last scrape (saved as a local file), if new assignment material found, update the local file and send the updates to me through Telegram Bot.

Requirements

import bs4, requests, os
import urllib.parse as ul
  • A telegram account.
  • A telegram bot (Use BotFather to create new bot accounts if you don't have one).
  • Optional: crontab as scheduler to run it on Linux machine.

Usage

$ pyhon3 updater.py

Scheduling

Crontab is a job scheduler on Ubuntu. Since the assignment is always due on Friday, I set the scheduler to run at minute 15 past every hour from 14 through 18 on Friday.

$ crontab -e
15 14-18 * * 5 /path/to/python3 /path/to/updater.py >> /path/to/cron.log 2>&1

About

Scrape lecture page to get assignment url and send updates through telegram bot.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages