예제 #1
0
def main():
    """pass"""

    # load weibonames
    path = os.path.abspath(
        os.path.join(os.path.dirname(__file__), 'conf/weibonames.conf'))
    with open(path) as fp:
        weibonames = [
            line.strip().decode('utf_8') for line in fp
            if not line.startswith('#')
        ]

    # create database
    dbpath = os.path.abspath(os.path.join(os.path.dirname(__file__), DBNAME))
    if not os.path.exists(dbpath):
        create_database(dbpath)

    # start crawler thread
    for name in weibonames:
        crawler = CrawlerThread(weiboname=name)
        crawler.start()

    # start download thread
    downloader = DownloadManager()
    downloader.start()