Exemplo n.º 1
0
    folder_name =  urlparse(url).path.replace("/","").replace("%","")
    with Ck12CorpusCreater(userid, password, os.path.join(os.path.dirname(__file__), "../../../corpus/{}".format(folder_name)),
                           logger=logger)   as  ck12CorpusCreater :
        ck12CorpusCreater.download_book(url)





log_dir = os.path.join(os.path.dirname(__file__),"../../../outputdata/Ck12CorpusCreater_{}".format(time.strftime('%Y%m%d_%H%M%S')))
Utilities.create_dir(log_dir)
log = setup_log(log_dir, "Ck12CorpusCreater")

try:

    credentialsCk12 = Utilities.get_credentials("https://www.ck12.org/")
    #
    # download("https://www.ck12.org/book/CK-12-Life-Science-Concepts-For-Middle-School",credentialsCk12, log)
    # download("https://www.ck12.org/book/CK-12-Earth-Science-Concepts-For-High-School", credentialsCk12,log)
    # download("https://www.ck12.org/book/CK-12-Earth-Science-Concepts-For-Middle-School", credentialsCk12,log)
    # download("https://www.ck12.org/book/CK-12-Physical-Science-Concepts-For-Middle-School",credentialsCk12,log)
    # download("https://www.ck12.org/book/CK-12-Biology-Concepts",credentialsCk12,log)
    # download("https://www.ck12.org/book/CK-12-Chemistry-Basic",credentialsCk12,log)
    # download("https://www.ck12.org/book/CK-12-Chemistry-Concepts-Intermediate",credentialsCk12,log)
    # download("https://www.ck12.org/book/CK-12-Physics-Concepts---Intermediate",credentialsCk12,log)
    ####download("https://www.ck12.org/book/CK-12-Understanding-Biodiversity",credentialsCk12,log)
    #download("https://www.ck12.org/book/CK-12-Biology-Advanced-Concepts/",credentialsCk12,log)
    #download("https://www.ck12.org/book/CK-12-21st-Century-Physics-A-Compilation-of-Contemporary-and-Emerging-Technologies/",credentialsCk12,log)
    download("https://www.ck12.org/book/Peoples-Physics-Book-Basic/",credentialsCk12,log)
    download("https://www.ck12.org/book/Peoples-Physics-Concepts/",credentialsCk12,log)
    download("https://www.ck12.org/book/Physics-From-Stargazers-to-Starships/",credentialsCk12,log)