mirror of
https://github.com/kemayo/leech
synced 2025-12-06 16:33:16 +01:00
Slightly more info about what happened
This commit is contained in:
parent
136c31ef22
commit
186daa19fb
1 changed files with 9 additions and 2 deletions
11
leech.py
11
leech.py
|
|
@ -29,6 +29,8 @@ def leech(url, filename=None):
|
||||||
return
|
return
|
||||||
|
|
||||||
story = site.extract(url, fetch)
|
story = site.extract(url, fetch)
|
||||||
|
if not story:
|
||||||
|
return
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
'title': story['title'],
|
'title': story['title'],
|
||||||
|
|
@ -43,6 +45,8 @@ def leech(url, filename=None):
|
||||||
|
|
||||||
epub.make_epub(filename, html, metadata)
|
epub.make_epub(filename, html, metadata)
|
||||||
|
|
||||||
|
return filename
|
||||||
|
|
||||||
_sites = []
|
_sites = []
|
||||||
|
|
||||||
def _get_site(url):
|
def _get_site(url):
|
||||||
|
|
@ -66,5 +70,8 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--filename', help="output filename (the title is used if this isn't provided)")
|
parser.add_argument('--filename', help="output filename (the title is used if this isn't provided)")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
leech(args.url, filename=args.filename)
|
filename = leech(args.url, filename=args.filename)
|
||||||
pass
|
if filename:
|
||||||
|
print("File created:", filename)
|
||||||
|
else:
|
||||||
|
print("A problem occurred.")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue