MCPcopy
hub / github.com/tornadoweb/tornado / get_links

Function get_links

demos/webspider/webspider.py:35–48  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

33
34
35def get_links(html):
36 class URLSeeker(HTMLParser):
37 def __init__(self):
38 HTMLParser.__init__(self)
39 self.urls = []
40
41 def handle_starttag(self, tag, attrs):
42 href = dict(attrs).get("href")
43 if href and tag == "a":
44 self.urls.append(href)
45
46 url_seeker = URLSeeker()
47 url_seeker.feed(html)
48 return url_seeker.urls
49
50
51async def main():

Callers 1

get_links_from_urlFunction · 0.85

Calls 1

URLSeekerClass · 0.85

Tested by

no test coverage detected