Esempio n. 1
0
def update_network(accounts, depth):
    for account_id in accounts.keys():
        print '\tupdating user:'******'\t\tupdating', acc_type, 'account:', acc_username

            if acc_username == '': continue

            if acc_type == DELICIOUS:
                crawl = DeliciousCrawler.factory(acc_username, depth=depth) 
            elif acc_type == FLICKR:
                crawl = FlickrCrawler.factory(acc_username, depth=depth)
            elif acc_type == SLIDESHARE:
                crawl = SlideShareCrawler.factory(acc_username, depth=depth)
            elif acc_type == TWITTER:
                crawl = TwitterCrawler.factory(acc_username, depth=depth)
            elif acc_type == YOUTUBE:
                crawl = YouTubeCrawler.factory(acc_username, depth=depth)

            personUris.append(crawl.getUserUri(acc_username))
            crawlers.append(crawl)

        # create crawlers using user network accounts data
        t1 = time.clock()
        CrawlNetworks(crawlers).crawl(start_time=sdate)
        t2 = time.clock()

        # link resources to each other
        Resource.unify_all(personUris)

        print 'Finished in %d seconds' % (t2 - t1)