MCPcopy Create free account
hub / github.com/Hello-SimpleAI/chatgpt-comparison-detection / parse_chat_row

Function parse_chat_row

HC3/selenium_crawler.py:261–277  ·  view source on GitHub ↗

解析 ChatGPT 返回内容, 并: 1)保持列表信息.

(response: WebElement)

Source from the content-addressed store, hash-verified

259other_tags = set()
260
261def parse_chat_row(response: WebElement) -> Anwser:
262 """
263 解析 ChatGPT 返回内容, 并: 1)保持列表信息.
264 """
265 children = response.find_elements(By.XPATH, './*')
266 anwser = list()
267 for tag in children:
268 if tag.tag_name == 'ol':
269 rows = tag.find_elements(By.XPATH, './*')
270 for i, r in enumerate(rows, 1):
271 anwser.append(f'{i}. {r.text}')
272 else:
273 if tag.tag_name not in other_tags:
274 other_tags.add(tag.tag_name)
275 printf('new tag:', tag.tag_name)
276 anwser.append(tag.text)
277 return anwser
278
279
280def get_response() -> Anwser:

Callers 1

get_responseFunction · 0.85

Calls 1

printfFunction · 0.70

Tested by

no test coverage detected