switched backend to readability-cli rather than roll my own

This commit is contained in:
lee2sman 2021-07-20 19:04:39 -04:00
parent 24a34721d6
commit c2cae799b9
1 changed files with 8 additions and 18 deletions

View File

@ -1,27 +1,17 @@
#!/usr/bin/env fish
set theme themes/sakura.css
set temp ./.temp.html
set theme themes/medium.css
# pulldown html page
wget --output-document $temp $argv
# Let's grab the page title
#
# solution from https://stackoverflow.com/questions/9312154/wget-page-title
set title (wget --quiet -O - $argv | paste -s -d " " | sed -n -e 's!.*<head[^>]*>\(.*\)</head>.*!\1!p' | sed -n -e 's!.*<title>\(.*\)</title>.*!\1!p')
# get title
set title (readable $argv --properties "title")
echo "title: " $title
cp $temp originals/$title.html
# pulldown html page
readable $argv --output originals/$title.html
# make rabid reader version
pandoc --self-contained -s $temp -c $theme --lua-filter=lib/remove-images.lua -o reader/$title.html
pandoc --self-contained -f html -t html -c $theme -o reader/$title.html originals/$title.html
# presto changeo converto from html to markdown
pandoc -f html -t markdown_github-raw_html --lua-filter=lib/remove-images.lua -o markdown/$title.md $temp
pandoc -f html -t markdown_github-raw_html -o markdown/$title.md originals/$title.html
pandoc -f html -t epub -o epubs/$title.epub --lua-filter=lib/remove-images.lua $temp
rm -f $temp
pandoc -f html -t epub -o epubs/$title.epub originals/$title.html