Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib.request
- import time
- import sys
- def reporthook(count, block_size, total_size):
- global start_time
- if count == 0:
- start_time = time.time()
- return
- duration = time.time() - start_time
- progress_size = int(count * block_size)
- speed = int(progress_size / (1024 * duration))
- percent = int(count * block_size * 100 / total_size)
- sys.stdout.write("\rСкачано: %d%% (%d MB), Скорость: %d KB/s, Прошло времени: %d сек" %
- (percent, progress_size / (1024 * 1024), speed, duration))
- sys.stdout.flush()
- print('Beginning file download with urllib2...')
- for x in range(1, 65):
- if x < 10:
- url = 'https://m1.audiokniga.club/uploads/books/book200/rus/reader103/192/00' + str(x) +'.mp3'
- else:
- url = 'https://m1.audiokniga.club/uploads/books/book200/rus/reader103/192/0' + str(x) +'.mp3'
- pass
- print(url)
- urllib.request.urlretrieve(url, './0' + str(x) + '.mp3', reporthook)
- print("downloaded " + str(x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement