Skip to content

Commit

Permalink
Merge branch 'main' into m67810_heif_text_and_font_item
Browse files Browse the repository at this point in the history
  • Loading branch information
podborski authored May 9, 2024
2 parents 196589a + 6eef4e4 commit cbef88a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
from glob import glob
from functools import cache
from bs4 import BeautifulSoup

from .unique_logger import logger

Expand Down Expand Up @@ -54,7 +55,16 @@ def get_document_status_toc():
logger.critical(f"Failed to get document status: {response.status_code}")
exit(1)

payload = response.json()["payload"]
# Parse the HTML to get the TOC
soup = BeautifulSoup(response.text, "html.parser")
data = json.loads(
soup.find(
"script",
{"type": "application/json", "data-target": "react-app.embeddedData"},
).string
)

payload = data["payload"]
toc = payload["blob"]["headerInfo"]["toc"]
return {
heading["text"]: DOCUMENT_STATUS_URL + f"#{heading['anchor']}"
Expand Down

0 comments on commit cbef88a

Please sign in to comment.