This commit is contained in:
feder 2017-01-31 20:38:00 +03:00
commit 1ef1dcdd57
3 muutettua tiedostoa jossa 95 lisäystä ja 0 poistoa

30
LICENSE Normal file
Näytä tiedosto

@ -0,0 +1,30 @@
pyElibDownloader
pyElibDownloader is released under the DWTW license.
This program is free software; you can redistribute it and/or modify it under the terms of the Do What Thou Wilt License.
DO WHAT THAU WILT
TO PUBLIC LICENSE
Version 2.5
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. Do what thou wilt shall be the whole of the Law.
Anyone is allowed to copy and distribute the copies of this license agreement in whole or in part, as well as modify it without any other limitations.
DWTW a license with a single requirement: DO WHAT THOU WILT
The license provides more freedom than any other one (such as GPL or BSD) and does not require saving the license text on copying.
DWTW an accomplished and eligible license for free text (including the software, documentation and artwork).
The license does not contain "no warranty" clause. DWTW can be used in countries that do not legally acknowledge the transition to public domain.
Summary:
An author-creator gives his or her source code to the world for free, without becoming distracted by worldly thinking regarding how and why the others will use it.

21
README Normal file
Näytä tiedosto

@ -0,0 +1,21 @@
pyElibDownloader 0.99
Simple book downloader for e-libraries, requires python3 and python wget module.
This script is developed for elib.shpl.ru, but may work with other libraries.
---
Простой загрузчик книг для электронных библиотек, ему необходимы python3 и модуль wget.
Этот срипт разработан для elib.shpl.ru, но может будет работать и с другим электронными библиотеками.
Использование
Предварительно установите модуль wget:
pip install wget
После этого запустите скрипт.
Если вы загружаете книгу с http://elib.shpl.ru, то на первый вопрос о префиксе ничего не пиште, а просто нажмите Enter. Также поступите и со второым вопросом о постфиксе и с третьим о разширении файлов.
На четвертый вопрос - введите имя папки в которой будут сохранятся картинки - например, назавание загружаемой книги. Новая папка будет создана там, где был запущен скрипт.
Перед ответом на пятый вопрос о первом индексе - откройте в электронной библиотеке http://elib.shpl.ru первую страницу книги и нажмите Загрузить -> Крупный размер, и скопируйте индекс изображения - числа между "http://elib.shpl.ru/pages/" и "/zooms/7". Вставьте этот индекс в ответ на пятый вопрос скрипта.
Последний, шестой вопрос - это индекс последней страницы книги. Скопируйте его анологично первому и вставьте в ответ скрипта.
После этого начнётся загрузка. Обычно загруженная таким образом книга на 300 страниц занимает около 100 мегабайт.

44
pyelibdownloader.py Executable file
Näytä tiedosto

@ -0,0 +1,44 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import wget, os
print ("pyElibDownloader")
promptprefix = ("Enter prefix of download URL (default [http://elib.shpl.ru/pages/]): ")
prefix = input (promptprefix)
if prefix == "":
prefix = ("http://elib.shpl.ru/pages/")
promptpostfix = ("Enter postfix of download URL (default [/zooms/7]): ")
postfix = input (promptpostfix)
if postfix == "":
postfix = ("/zooms/7")
promptextension = ("Enter files extension (default [jpg]): ")
extension = input (promptextension)
if extension == "":
extension = ("jpg")
promptdir = ("Enter directory name: ")
dir = ""
while dir == "":
dir = input (promptdir)
promptfirstindex = ("Enter first index: ")
firstindex = ""
while firstindex == "":
firstindex = input (promptfirstindex)
promptlastindex = ("Enter last index: ")
lastindex = ""
while lastindex == "":
lastindex = input (promptlastindex)
print ("Starting donwload...")
try:
os.stat(dir)
except:
os.mkdir(dir)
os.chdir(dir)
index = int(firstindex)
lastindex = int(lastindex)
while index <= lastindex:
filename = str(index) + "." + extension
url = prefix + str(index) + postfix
wget.download(url,out=filename)
index = index + 1
print ("Donwload finished.")