MCPcopy Create free account
hub / github.com/davisking/dlib / Links

Class Links

tools/htmlify/test_htmlify.py:14–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14class Links(HTMLParser):
15 def __init__(self, page):
16 super().__init__()
17 self.urls = []
18 self.feed(page.read_text())
19
20 def handle_starttag(self, tag, attrs):
21 if tag == "a":
22 self.urls.extend(value for key, value in attrs if key == "href")
23
24
25class IncludeLinks(unittest.TestCase):

Calls

no outgoing calls