From 4031d611bbb4b3380ba4a36a1af8153bd0af71f3 Mon Sep 17 00:00:00 2001 From: BhasherBEL Date: Fri, 19 Apr 2024 12:20:32 +0200 Subject: [PATCH] restoU fix --- builds/maubot-resotU/main.py | 15 +++++++++++---- builds/tg2 | 2 +- bxl-shp/config/dashy/config-sd.yml | 5 +++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/builds/maubot-resotU/main.py b/builds/maubot-resotU/main.py index acc5030..54d1a37 100644 --- a/builds/maubot-resotU/main.py +++ b/builds/maubot-resotU/main.py @@ -18,9 +18,16 @@ async def extract_picture_url(url, base_url): images = soup.find_all('img') - for img in images: - src = img.get('src') - if src and src.startswith(base_url): + for a in soup.find_all('a'): + href = a.get('href') + if not href or not href.startswith(base_url): + continue + + for img in a.find_all('img'): + src = img.get('src') + if not src or not src.startswith(base_url): + continue + if src.startswith('//'): return f"https:{src}" else: @@ -59,7 +66,7 @@ class UCLouvainRestoUBot(Plugin): data = await download_image( await extract_picture_url( "https://uclouvain.be/fr/decouvrir/resto-u/le-galilee-self.html", - "//cdn.uclouvain.be/groups/cms-editors-resto-u/menu" + "//cdn.uclouvain.be/groups/cms-editors-resto-u/" ) ) url = await self.client.upload_media(data, mime_type="application/json") diff --git a/builds/tg2 b/builds/tg2 index a2eff32..e618a7f 160000 --- a/builds/tg2 +++ b/builds/tg2 @@ -1 +1 @@ -Subproject commit a2eff3236238fd1d0be818b81a0b05854761b02d +Subproject commit e618a7fb0d38939c4556d9da55bfe268b7f80dc4 diff --git a/bxl-shp/config/dashy/config-sd.yml b/bxl-shp/config/dashy/config-sd.yml index e1e2105..29c6d66 100644 --- a/bxl-shp/config/dashy/config-sd.yml +++ b/bxl-shp/config/dashy/config-sd.yml @@ -87,3 +87,8 @@ sections: url: https://uclouvain.atlassian.net/jira/dashboards/10025 statusCheck: false id: 5_1631_jira + - title: Gestion accès externes + url: >- + https://sites.uclouvain.be/sgsi-apps/shib-accesressources/prod/index.php + statusCheck: false + id: 6_1631_gestionaccsexternes