version bump

This commit is contained in:
2017-04-09 17:39:59 +02:00
parent 08dd3dc7ae
commit a9786ed238
3 changed files with 36 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
# slideslurp # slideslurp
Give slideslurp a URL to a [SlideShare](https://www.slideshare.net/) Give slideslurp a URL to a [SlideShare](https://www.slideshare.net/)
presentation and it will give you a PDF called `out.pdf`. presentation and it will render it as a PDF.
I will clean this up, I promise. I will clean this up, I promise.
@@ -11,5 +11,21 @@ I will clean this up, I promise.
pip install slideslurp pip install slideslurp
``` ```
## Usage
```
usage: slideslurp [-h] [--output OUTPUT] url
Generate PDFs from Slideshare presentations
positional arguments:
url the URL to slurp
optional arguments:
-h, --help show this help message and exit
--output OUTPUT, -o OUTPUT
the file to write to (default: out.pdf)
```
<hr/> <hr/>
Happy slurping! Happy slurping!

View File

@@ -6,13 +6,13 @@ from setuptools import setup
setup( setup(
name = 'slideslurp', name = 'slideslurp',
version = '0.0.3', version = '0.0.4',
description = 'SlideShare to PDF', description = 'SlideShare to PDF',
author = 'Veit Heller', author = 'Veit Heller',
author_email = 'veit@veitheller.de', author_email = 'veit@veitheller.de',
license = 'MIT License', license = 'MIT License',
url = 'https://github.com/hellerve/slideslurp', url = 'https://github.com/hellerve/slideslurp',
download_url = 'https://github.com/hellerve/slideslurp/tarball/0.0.3', download_url = 'https://github.com/hellerve/slideslurp/tarball/0.0.4',
packages = find_packages('.'), packages = find_packages('.'),
install_requires=[ install_requires=[
"bs4", "bs4",

View File

@@ -1,3 +1,4 @@
import argparse
import sys import sys
import bs4 import bs4
@@ -6,16 +7,25 @@ import requests
from reportlab.pdfgen import canvas from reportlab.pdfgen import canvas
def main(): def parse_args():
if not len(sys.argv) == 2: descr = "Generate PDFs from Slideshare presentations"
print("Usage: slideslurp <url>")
sys.exit(1)
url = sys.argv[1]
res = requests.get(url) parser = argparse.ArgumentParser(description=descr)
parser.add_argument('url', metavar='url', nargs=1,
help='the URL to slurp')
parser.add_argument('--output', '-o', default='out.pdf',
help='the file to write to (default: out.pdf)')
return parser.parse_args()
def main():
args = parse_args()
res = requests.get(args.url)
tree = bs4.BeautifulSoup(res.text, "html.parser") tree = bs4.BeautifulSoup(res.text, "html.parser")
c = canvas.Canvas('out.pdf') c = canvas.Canvas(args.file)
for img in tree.findAll("img", class_="slide_image"): for img in tree.findAll("img", class_="slide_image"):
img_url = img.attrs["data-full"] img_url = img.attrs["data-full"]