()
| 161 | return opts, args |
| 162 | |
| 163 | def main(): |
| 164 | opts, args = parse_options() |
| 165 | |
| 166 | url = args[0] |
| 167 | |
| 168 | if opts.links: |
| 169 | getLinks(url) |
| 170 | raise SystemExit, 0 |
| 171 | |
| 172 | depth = opts.depth |
| 173 | |
| 174 | sTime = time.time() |
| 175 | |
| 176 | print "Crawling %s (Max Depth: %d)" % (url, depth) |
| 177 | crawler = Crawler(url, depth) |
| 178 | crawler.crawl() |
| 179 | print "\n".join(crawler.urls) |
| 180 | |
| 181 | eTime = time.time() |
| 182 | tTime = eTime - sTime |
| 183 | |
| 184 | print "Found: %d" % crawler.links |
| 185 | print "Followed: %d" % crawler.followed |
| 186 | print "Stats: (%d/s after %0.2fs)" % ( |
| 187 | int(math.ceil(float(crawler.links) / tTime)), tTime) |
| 188 | |
| 189 | if __name__ == "__main__": |
| 190 | main() |
no test coverage detected