From 1ef1dcdd57678006e0ee8fdc0c9515b74d3f869b Mon Sep 17 00:00:00 2001 From: feder Date: Tue, 31 Jan 2017 20:38:00 +0300 Subject: [PATCH] Add project --- LICENSE | 30 ++++++++++++++++++++++++++++++ README | 21 +++++++++++++++++++++ pyelibdownloader.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 LICENSE create mode 100644 README create mode 100755 pyelibdownloader.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..38e6993 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README b/README new file mode 100644 index 0000000..1f8c5f3 --- /dev/null +++ b/README @@ -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 мегабайт. diff --git a/pyelibdownloader.py b/pyelibdownloader.py new file mode 100755 index 0000000..67b700e --- /dev/null +++ b/pyelibdownloader.py @@ -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.")