Skip to content

Commit

Permalink
Fix maxroll guide import with new paperdoll (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisoro authored Oct 11, 2024
1 parent 79951dc commit 6de0b14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

TP = concurrent.futures.ThreadPoolExecutor()

__version__ = "5.8.2"
__version__ = "5.8.3"
13 changes: 9 additions & 4 deletions src/gui/importer/maxroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,23 @@ def _extract_planner_url_and_id_from_guide(url: str) -> tuple[str, int]:
LOGGER.exception(msg := "Couldn't get build guide")
raise MaxrollException(msg) from exc
data = lxml.html.fromstring(r.text)
msg = "Couldn't find planner url in build guide. Use planner link directly and report bug"
if not (embed := data.xpath(BUILD_GUIDE_PLANNER_EMBED_XPATH)):
LOGGER.error(msg := "Couldn't find planner url in build guide")
LOGGER.error(msg)
raise MaxrollException(msg)
planner_id = embed[0].get("data-d4-profile")
data_id = int(embed[0].get("data-d4-id")) - 1
try:
planner_id = embed[0].get("data-d4-profile")
data_id = int(embed[0].get("data-d4-data").split(",")[0])
except Exception as ex:
LOGGER.exception(msg)
raise MaxrollException(msg) from ex
return PLANNER_API_BASE_URL + planner_id, data_id


if __name__ == "__main__":
src.logger.setup()
URLS = [
"https://maxroll.gg/d4/planner/pl7lv0kv#3",
"https://maxroll.gg/d4/build-guides/quill-volley-spiritborn-guide",
]
for X in URLS:
import_maxroll(url=X)

0 comments on commit 6de0b14

Please sign in to comment.