| 100 | # LIFO means last-in-first-out: more recently queued links will be visited sooner. |
| 101 | |
| 102 | class 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…