Пример #1
0
def download():
    lines = ["Topics"]
    thread_pool = ThreadPool()
    d = False

    if enable_proxie[0]:
        refresh_proxie()

    filename = datetime.datetime.now().strftime("%d-%m-%Y %H-%M-%S") + '.txt'
    for i, enable in enumerate(download_enables):
        if enable:
            thread_pool.give_task(download_concrete_page,
                                  args=(download_hrefs[i], lines))
            d = True

    thread_pool.join()
    if d:
        file = open(filename, 'w')
        file.write('\n'.join(lines))
        file.close()

        print(f'All chosen topics are saved to {filename}')
        to_main_menu()
    else:
        print("Nothing is chosen")
    input("Press <Enter> to continue")

    return True