From 5f3f521fedfb0afdede5cc37739c698c326eb795 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Sat, 11 Feb 2023 20:56:13 -0500 Subject: [PATCH] add watch scripts for sourceforge lgames --- lbreakouthd/.watch | 23 +++++++++++++++++++++++ ltris/.watch | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 lbreakouthd/.watch create mode 100755 ltris/.watch diff --git a/lbreakouthd/.watch b/lbreakouthd/.watch new file mode 100755 index 0000000..ebe18a8 --- /dev/null +++ b/lbreakouthd/.watch @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +from subprocess import Popen,PIPE +from bs4 import BeautifulSoup as bs + +def get_html(url): + try: + curlpipe = Popen(["/usr/bin/curl","-s","-L",url],stdout=PIPE) + except: + print("- Request error: unable to retrieve {}".format(url)) + return None + curltup = curlpipe.communicate() + return curltup[0] + +page = get_html("https://lgames.sourceforge.io/downloads.php") +soup = bs(page, 'lxml') +refs = soup.body.find_all('a') + +for a in refs: + nv=a.get_text() + if nv[0:11] == "lbreakouthd" and nv[-6:] == "tar.gz": + print(nv[12:-7]) + break diff --git a/ltris/.watch b/ltris/.watch new file mode 100755 index 0000000..5de245c --- /dev/null +++ b/ltris/.watch @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +from subprocess import Popen,PIPE +from bs4 import BeautifulSoup as bs + +def get_html(url): + try: + curlpipe = Popen(["/usr/bin/curl","-s","-L",url],stdout=PIPE) + except: + print("- Request error: unable to retrieve {}".format(url)) + return None + curltup = curlpipe.communicate() + return curltup[0] + +page = get_html("https://lgames.sourceforge.io/downloads.php") +soup = bs(page, 'lxml') +refs = soup.body.find_all('a') + +for a in refs: + nv=a.get_text() + if nv[0:5] == "ltris" and nv[-6:] == "tar.gz": + print(nv[6:-7]) + break