Called from Crawler.crawl() to determine the priority of this link, as a number between 0.0-1.0. Links with higher priority are visited first.
(self, link, method=DEPTH)
| 3234 | return True |
| 3235 | |
| 3236 | def priority(self, link, method=DEPTH): |
| 3237 | """ Called from Crawler.crawl() to determine the priority of this link, |
| 3238 | as a number between 0.0-1.0. Links with higher priority are visited first. |
| 3239 | """ |
| 3240 | # Depth-first search dislikes external links to other (sub)domains. |
| 3241 | external = base(link.url) != base(link.referrer) |
| 3242 | if external is True: |
| 3243 | if method == DEPTH: |
| 3244 | return 0.75 |
| 3245 | if method == BREADTH: |
| 3246 | return 0.85 |
| 3247 | return 0.80 |
| 3248 | |
| 3249 | def visit(self, link, source=None): |
| 3250 | """ Called from Crawler.crawl() when the link is crawled. |