diff --git a/plugins/steam.py b/plugins/steam.py
index 289d6ca..f5fc7e0 100644
--- a/plugins/steam.py
+++ b/plugins/steam.py
@@ -19,26 +19,37 @@ def get_steam_info(url):
# get the element details_block
details = soup.find('div', {'class': 'details_block'})
- # MAGIC
+ # loop over every tag in details_block
for b in details.findAll('b'):
+ # get the contents of the tag, which is our title
title = b.text.lower().replace(":", "")
if title == "languages":
# we have all we need!
break
+ # find the next element directly after the tag
next = b.nextSibling
if next:
+ # if the element is some text
if isinstance(next, NavigableString):
text = next.string.strip()
if text:
+ # we found valid text, save it and continue the loop
data[title] = text
continue
- else:
+ else:
+ # the text is blank - sometimes this means there are
+ # useless spaces or tabs between the and tags.
+ # so we find the next tag and carry on to the next
+ # bit of code below
next = next.find_next('a', href=True)
+ # if the element is an tag
if isinstance(next, Tag) and next.name == 'a':
text = next.string.strip()
if text:
+ # we found valid text (in the tag),
+ # save it and continue the loop
data[title] = text
continue