Skip to content

Commit

Permalink
Microsoft Edge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
twkrol committed Mar 9, 2021
1 parent 6c22e1a commit ce2b247
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
48 changes: 25 additions & 23 deletions clients/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion start.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import argparse
import vergrabber

__version__ = '4.2.2'
__version__ = '4.2.3'
__author__ = 'Tomasz Krol'
__author_email__ = '[email protected]'

Expand Down

0 comments on commit ce2b247

Please sign in to comment.