История изменений
Исправление Siado, (текущая версия) :
Наслаждайся. Только не все книги тянет, видимо не все есть в fb2 (Потом надо просто удалить файлы с нулевым размером)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fldl.py
#
# Copyright 2012 Alex <elfjse@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
import urllib
import re
import sys
import subprocess
def get_page(url):
f = urllib.urlopen(url)
tmp = f.read()
f.close()
return tmp
def find_books(data):
return re.findall(r'<a href=/b/([0-9]+)>(.+)</a><br>', data)
if __name__ == '__main__':
try:
ar = sys.argv[1]
except:
print "default url:http://proxy.flibusta.net/g/sf_action/Pop"
print "usage: fbdl [url]"
ar = 'http://proxy.flibusta.net/g/sf_action/Pop'
p = get_page(ar)
for book_id in find_books(p):
url = 'http://proxy.flibusta.net/b/%s/fb2' % book_id[0]
fl ='%s.zip' % book_id[1]
cmd = ['wget', url, '-O', fl]
subprocess.call(cmd)
Исходная версия Siado, :
Наслаждайся. Только не все книги тянет, видимо не все есть в fb2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fldl.py
#
# Copyright 2012 Alex <elfjse@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
import urllib
import re
import sys
import subprocess
def get_page(url):
f = urllib.urlopen(url)
tmp = f.read()
f.close()
return tmp
def find_books(data):
return re.findall(r'<a href=/b/([0-9]+)>(.+)</a><br>', data)
if __name__ == '__main__':
try:
ar = sys.argv[1]
except:
print "default url:http://proxy.flibusta.net/g/sf_action/Pop"
print "usage: fbdl [url]"
ar = 'http://proxy.flibusta.net/g/sf_action/Pop'
p = get_page(ar)
for book_id in find_books(p):
url = 'http://proxy.flibusta.net/b/%s/fb2' % book_id[0]
fl ='%s.zip' % book_id[1]
cmd = ['wget', url, '-O', fl]
subprocess.call(cmd)