Skip to content

Commit

Permalink
feat: check last 50 release notes instead of last 20
Browse files Browse the repository at this point in the history
Checking for release notes changes was previously limited to last 20 release notes. Because Apple updated some of the very old ones, ApplSec did not catch them. The number has been increased.
  • Loading branch information
amadejpapez committed Nov 7, 2021
1 parent e44d75f commit 3aa7f43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions ApplSec/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

releases = re.findall(r"(?<=<tr>)(?:.|\n)*?(?=<\/tr>)", mainPage)
releases.pop(0) # remove first row
lastTwentyReleases = releases[:20]
lastFiftyReleases = releases[:50]

lastTwentyReleaseNames = []
for release in lastTwentyReleases:
lastTwentyReleaseNames.append(
lastFiftyReleaseNames = []
for release in lastFiftyReleases:
lastFiftyReleaseNames.append(
re.findall(r"(?<=<td>)(?:.|\n)*?(?=<\/td>)", release)[0]
)

Expand All @@ -28,14 +28,14 @@

# if there are new releases, run tweetNewUpdates()
if len(str(date.today().day)) > 1:
day = date.today().day
day = str(date.today().day)
else:
day = f"0{date.today().day}"

currentDateFormatOne = f"{day} {date.today().strftime('%b')} {date.today().year}"

newReleases = []
for release in lastTwentyReleases:
for release in lastFiftyReleases:
if f"<td>{currentDateFormatOne}</td>" in release:
newReleases.append(release)

Expand Down Expand Up @@ -65,7 +65,7 @@
if key == "macOS":
# alongside of the version also get the macOS name
latestVersion["macOS"] = re.findall(
rf"{key}\s([a-z\s]+[0-9]+)", str(lastTwentyReleaseNames), re.IGNORECASE
rf"{key}\s([a-z\s]+[0-9]+)", str(lastFiftyReleaseNames), re.IGNORECASE
)[0]


Expand Down Expand Up @@ -119,10 +119,10 @@


# if there are any changes to the last 20 release notes, run tweetEntryChanges()
lastTwentyReleasesInfo = getData(lastTwentyReleases)
lastFiftyReleasesInfo = getData(lastFiftyReleases)
entryChangesInfo = {}

for key, value in lastTwentyReleasesInfo.items():
for key, value in lastFiftyReleasesInfo.items():
if value["added"] or value["updated"]:
entryChangesInfo[key] = value

Expand All @@ -148,7 +148,7 @@
# if any releases got releases notes, run tweetReleaseNotesAvailable()
releaseNotesAvailableInfo = {}

for key, value in lastTwentyReleasesInfo.items():
for key, value in lastFiftyReleasesInfo.items():
if (
key not in storedDataFile["details_available_soon"]
and value["CVEs"] == "no details yet"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tweepy==3.10.0
emoji==1.4.1
emoji==1.6.1
requests==2.26.0

0 comments on commit 3aa7f43

Please sign in to comment.