-
Notifications
You must be signed in to change notification settings - Fork 0
/
forzaHorizon4.py
executable file
·30 lines (23 loc) · 1.02 KB
/
forzaHorizon4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import re
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
from main_code import grab_update_text
recipient = '[email protected]'
subject = 'Forza Horizon 4 Update'
file_name = 'forzaHorizon4'
site= "https://support.forzamotorsport.net/hc/en-us/sections/360000354527-Release-Notes-and-Known-Issues"
hdr = {'User-Agent': 'Mozilla/5.0'}
req = Request(site,headers=hdr)
page = urlopen(req).read()
soup = BeautifulSoup(page, 'html.parser')
anchorHeading = soup.find("a", attrs={'class':'article-list-link'}).text
anchorLink = soup.find("a", attrs={'class':'article-list-link'})['href']
if anchorHeading == 'FH4 Known Issues':
anchorHeading = soup.find_all("a", attrs={'class':'article-list-link'})[1].text
anchorLink = soup.find_all("a", attrs={'class':'article-list-link'})[1]['href']
findWord = re.compile(r'FH4 Release Notes:')
# print(anchorHeading)
grab_update_text(recipient, subject, findWord, anchorHeading, site, file_name)