(blob, start_idx)
| 14689 | html = page.content() |
| 14690 | if html: |
| 14691 | def _extract_json_obj(blob, start_idx): |
| 14692 | i = start_idx |
| 14693 | while i < len(blob) and blob[i].isspace(): |
| 14694 | i += 1 |
| 14695 | if i >= len(blob) or blob[i] != '{': |
| 14696 | return "" |
| 14697 | depth = 0 |
| 14698 | in_string = False |
| 14699 | esc = False |
| 14700 | quote = "" |
| 14701 | j = i |
| 14702 | while j < len(blob): |
| 14703 | ch = blob[j] |
| 14704 | if in_string: |
| 14705 | if esc: |
| 14706 | esc = False |
| 14707 | elif ch == "\\": |
| 14708 | esc = True |
| 14709 | elif ch == quote: |
| 14710 | in_string = False |
| 14711 | else: |
| 14712 | if ch in ("'", '"'): |
| 14713 | in_string = True |
| 14714 | quote = ch |
| 14715 | elif ch == '{': |
| 14716 | depth += 1 |
| 14717 | elif ch == '}': |
| 14718 | depth -= 1 |
| 14719 | if depth == 0: |
| 14720 | return blob[i:j + 1] |
| 14721 | j += 1 |
| 14722 | return "" |
| 14723 | |
| 14724 | def _extract_from_embedded_json(html_text): |
| 14725 | script_blobs = re.findall(r"<script[^>]*>(.*?)</script>", html_text, flags=re.DOTALL | re.IGNORECASE) |
nothing calls this directly
no outgoing calls
no test coverage detected