Skip to content

Commit

Permalink
Fixed case where links could be missed
Browse files Browse the repository at this point in the history
- Fixed case where links could be missed
- Simplified fetching thumbnail URL
- Updated download sites
  • Loading branch information
bbtufty committed Oct 25, 2024
1 parent 522d90a commit 50a261c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.3 (Unreleased)
================

- Fixed case where links could be missed [#13]
- GUI updates [#12]
- Logging updates [#11]
- Update docs to reflect region preferences [#10]
Expand Down
1 change: 1 addition & 0 deletions nxbrew_dl/configs/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dl_sites:
- "FreeDL"
- "GoFile"
- "HexLoad"
- "HexUpload"
- "MegaUp"
- "MixDrop"

Expand Down
7 changes: 6 additions & 1 deletion nxbrew_dl/util/download_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ def parse_base_game(
finding_links = False

# Finally, hunt through to the next tag WITHOUT a link in
tag = tag.find_next("p", href=False)
found_links = True
while found_links:
tag = tag.find_next("p", href=False)
links = tag.find_all("a", href=True)
if len(links) == 0:
found_links = False

return tag, base_game_dict

Expand Down
7 changes: 2 additions & 5 deletions nxbrew_dl/util/html_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,7 @@ def get_thumb_url(soup):
soup (bs4.BeautifulSoup): soup object to find languages in
"""

# Get the main content, then find the first figure which we'll take as the thumbnail
content = soup.find("div", {"id": "content"})
thumb = content.findAll("figure")[0]
img = thumb.find("img")
url = img["src"]
img = soup.find("meta", {"property": "og:image"})
url = img["content"]

return url

0 comments on commit 50a261c

Please sign in to comment.