From eb14fcf44ecb38875753ac85b239ffcf86431c9c Mon Sep 17 00:00:00 2001 From: Mihit Date: Sun, 9 Mar 2025 07:32:57 +1100 Subject: [PATCH] init --- omada-downloader.py | 18 ++++++++++++++++++ requirements.txt | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 omada-downloader.py create mode 100644 requirements.txt diff --git a/omada-downloader.py b/omada-downloader.py new file mode 100644 index 0000000..0b5bbe1 --- /dev/null +++ b/omada-downloader.py @@ -0,0 +1,18 @@ +from bs4 import BeautifulSoup +import requests + +def get_latest(): + web_data = requests.get("https://support.omadanetworks.com/us/product/omada-software-controller/?resourceType=download") + assert web_data.status_code in range(200, 300) + soup = BeautifulSoup(web_data.content, "html.parser") + urls = soup.find_all("a", attrs={"data-vars-event-category": "Product_Download_Download"}) + urls = [i["href"] for i in urls if ".deb" in i["href"]] + urls.sort(reverse=True) + return urls[0] + +def main(): + with open("omada_latest.deb", "wb") as file: + file.write(requests.get(get_latest()).content) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1f311f5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests +bs4 \ No newline at end of file