Skip to content

Instantly share code, notes, and snippets.

Created September 17, 2016 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b41b2b4407b53185e9694882d538b49d to your computer and use it in GitHub Desktop.
Save anonymous/b41b2b4407b53185e9694882d538b49d to your computer and use it in GitHub Desktop.
import scrapy, os, time
class TBTCrawler(scrapy.Spider):
name = 'tbt'
def start_requests(self):
self.t1 = time.time()
r = scrapy.Request('http://www.tahribat.com/Forum/')
yield(r)
def parse(self, response):
c = len(response.xpath('//a/@href'))
self.t2 = time.time()
print self.t2 - self.t1
if __name__ == "__main__":
com = 'scrapy runspider "%s"' % __file__
os.system(com)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment