From ce2b247ed45537a9bb364ff3be587aef3cf2ada9 Mon Sep 17 00:00:00 2001 From: Kingu Date: Tue, 9 Mar 2021 21:19:22 +0100 Subject: [PATCH] Microsoft Edge fix --- clients/edge.py | 48 +++++++++++++++++++++++++----------------------- start.py | 2 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/clients/edge.py b/clients/edge.py index 531c1c4..a209229 100644 --- a/clients/edge.py +++ b/clients/edge.py @@ -22,39 +22,41 @@ def getEditions(template): template.latest = True #Looking for releases - body = urllib.request.urlopen("https://raw.githubusercontent.com/MicrosoftDocs/Edge-Enterprise/public/edgeenterprise/microsoft-edge-relnote-stable-channel.md").read() + body = urllib.request.urlopen("https://docs.microsoft.com/en-us/deployedge/microsoft-edge-relnote-stable-channel").read() soup = BeautifulSoup(body, "html5lib") - for i, string in enumerate(soup.get_text().splitlines()): - if string.startswith("## Version"): - # the version line format is: "## Version 87.0.664.66: December 17" - elements = string.split(' ') + for item in soup.find_all('h2'): + contents = item.get_text() + if contents.startswith("Version"): + # the version line format is: "Version 89.0.774.48: March 8" + elements = contents.split(' ') # read version skipping the ending ":" - releaseVersion = elements[2][:-1] - + releaseVersion = elements[1][:-1] + # decode date, mind the year which is not provided (yet) and must be guessed - releaseDate = datetime.strptime(f"{elements[3]} {elements[4]}, {datetime.now().year}", '%B %d, %Y') + releaseDate = datetime.strptime(f"{elements[2]} {elements[3]}, {datetime.now().year}", '%B %d, %Y') if releaseDate.date() > datetime.now().date(): - releaseDate = datetime.strptime(f"{elements[3]} {elements[4]}, {datetime.now().year-1}", '%B %d, %Y') + releaseDate = datetime.strptime(f"{elements[2]} {elements[3]}, {datetime.now().year-1}", '%B %d, %Y') - break - - debug(f"version:{releaseVersion}") - debug(f"releaseDate: {releaseDate}") + debug(f"version:{releaseVersion}") + debug(f"releaseDate: {releaseDate}") - item = copy.copy(template) #copy of Softver object + item = copy.copy(template) #copy of Softver object - #find release date - item.released = releaseDate.date() + #find release date + item.released = releaseDate.date() - #find version - value = releaseVersion - item.version = value - value = re.search('\d+\.\d+',value) - item.edition = value.group() - - result.append(item) + #find version + value = releaseVersion + item.version = value + value = re.search('\d+',value) + item.edition = value.group() + + result.append(item) + + # today, we're not interested in older releases + break return result diff --git a/start.py b/start.py index 764b440..665fdee 100644 --- a/start.py +++ b/start.py @@ -14,7 +14,7 @@ import argparse import vergrabber -__version__ = '4.2.2' +__version__ = '4.2.3' __author__ = 'Tomasz Krol' __author_email__ = 'vergrabber@kingu.pl'