MCPcopy Create free account
hub / github.com/clips/pattern / SimpleCrawler2

Class SimpleCrawler2

examples/01-web/13-crawler.py:102–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100# LIFO means last-in-first-out: more recently queued links will be visited sooner.
101
102class SimpleCrawler2(Crawler):
103
104 def visit(self, link, source=None):
105 print "visiting:", link.url, "from:", link.referrer
106
107 def priority(self, link, method=DEPTH):
108 if "?" in link.url:
109 # This ignores links with a querystring.
110 return 0.0
111 else:
112 # Otherwise use the default priority ranker,
113 # i.e. the priority depends on DEPTH or BREADTH crawl mode.
114 return Crawler.priority(self, link, method)
115
116# Note the LIFO sort order.
117# This will make more recently queued links more relevant.

Callers 1

13-crawler.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…