Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/update unity website #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ dmypy.json

# Pyre type checker
.pyre/


# Jetbrains IDE
.idea/
Empty file added src/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions src/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def __init__(self, url):
page = urlopen(url)
# parse the html using beautiful soup and store in variable `soup`
soup = BeautifulSoup(page, 'html.parser')
mainPage = soup.find('h2', text='Release notes')
self.PageData = mainPage.parent
mainPage = soup.find('h2', text='Release Notes')
self.PageData = mainPage.parent.find('div', attrs={'class': 'release-notes'})



Expand Down
4 changes: 2 additions & 2 deletions src/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

UNITY_ROOT = 'https://unity3d.com'
PAGE_PREFIX_PATH = UNITY_ROOT + '/unity/whats-new'
UNITY_ROOT = 'https://unity.com'
PAGE_PREFIX_PATH = UNITY_ROOT + '/releases/editor/whats-new'
8 changes: 7 additions & 1 deletion src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
from bs4 import BeautifulSoup

def loadUnityVersions():
base_search_page = PAGE_PREFIX_PATH + '/unity-5.6.0'
base_search_page = PAGE_PREFIX_PATH + '/5.6.0'
page = urlopen(base_search_page)
# parse the html using beautiful soup and store in variable `soup`
soup = BeautifulSoup(page, 'html.parser')

# Take out the <div> of name and get its value
mainPage = soup.find('div', attrs={'class': 'full-release'})
if mainPage is None:
print('Did not find div, probably unity website structure changed')
mainPage = soup.find('div', attrs={'class': 'releases-item-list'})
versionDropdown = mainPage.find('ul', attrs={'class': 'options'})
if versionDropdown is None:
versionDropdown = mainPage.find('ul')



entries = versionDropdown.findAll('a')
Expand Down