MCPcopy Create free account
hub / github.com/EZ-hwh/AutoScraper / parse_accessibility_tree

Function parse_accessibility_tree

utils/html_utils.py:93–105  ·  view source on GitHub ↗
(html, indent='\t')

Source from the content-addressed store, hash-verified

91 return html
92
93def parse_accessibility_tree(html, indent='\t'):
94 soup = BeautifulSoup(html, 'html.parser')
95 for element in soup(text=lambda text: isinstance(text, bs4.Comment)):
96 element.extract()
97 [s.extract() for s in soup('script')]
98 [s.extract() for s in soup('style')]
99
100 accessibility_tree = ''
101 for node in soup.children:
102 if isinstance(node, bs4.NavigableString):
103 pass
104 else:
105 parse_accessibility_tree()
106
107def num_tokens_from_string(string: str, encoding_name: str) -> int:
108 encoding = tiktoken.get_encoding(encoding_name)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected