Re:The Accidental Book Review That Made Jack Kerouac Famous
by 3xblah on Tuesday December 17, 2019 @04:57AM
(#21812160)
If desired, substitute browser of choice for "firefox". Can leave Javascript enabled.
[ Parent
| on HN ]
Re:The Accidental Book Review That Made Jack Kerouac Famous
by dredmorbius on Thursday December 19, 2019 @01:11AM
(#21832400)
A few further findings:
1. WashPo delay curl requests by about 8 seconds. Changing user-agent to anything other will defeat this.
2. The size of the actually-useful bits of the page is about 3% of just the primary HTML page transferred. That's excluding images, external CSS/JS, and prefetched content.
That's a pretty considerable chunk.
Re:The Accidental Book Review That Made Jack Kerouac Famous
by dredmorbius on Tuesday December 17, 2019 @12:06PM
(#21815651)
As a shell script, feeding w3m directly (it will read stdin, as will lynx):
#!/bin/sh
set -e
curl -s "${1}" |
tr -cd '\11\12\15\40-\176' |
sed 's/</\n</g' |
sed -n '/./{/<p class=.font--body/,/<\/p>/p;}' |
/usr/bin/w3m -T text/html
I've called this "washpo".The argument is the URL you want view.
If you're a stickler for well-formed HTML, you can add a pipeline for tidy as well ;-)
tidy -i -w 120 --quiet |
Immediately before your browser of choice.And if you want to retain the title and dateline, use this version:
Re:The Accidental Book Review That Made Jack Kerouac Famous
by sogen on Tuesday December 17, 2019 @12:35PM
(#21816076)
w3m, nice! forgot I had it installed
Re:The Accidental Book Review That Made Jack Kerouac Famous
by pjc50 on Tuesday December 17, 2019 @07:47AM
(#21812933)
If you're calling from the EU, this gets stuck in an endless loop of GDPR consent redirects.
Re:The Accidental Book Review That Made Jack Kerouac Famous
by 3xblah on Tuesday December 17, 2019 @01:09PM
(#21816551)
Nothing in the filtered output that could cause a redirect.
If HTTP 3xx redirect, maybe try using a cache URL instead, e.g.,
curl http://web.archive.org/web/20191214075242/https://www.washingtonpost.com/outlook/the-accidental-book-review-that-made-jack-kerouac-famous/2019/12/13/23e94230-04b3-11ea-b17d-8b867891d39d_story.html?outputType=amp |tr -cd '\11\12\15\40-\176' |sed 's/</\n</g' | sed -n '/./{/<p class=.font--body/,/<\/p>/p;}' > 1.htm
firefox 1.htm
Re:The Accidental Book Review That Made Jack Kerouac Famous
by spurgu on Tuesday December 17, 2019 @09:40AM
(#21813844)
What I did was:
1. Visit the link until it complains about adblocker
2. Disable JS for washingtonpost.com (using NoScript)
If I block JS directly I just get a GDPR (almost) blank page.
Re:The Accidental Book Review That Made Jack Kerouac Famous
by sogen on Tuesday December 17, 2019 @11:02AM
(#21814829)
nice! any way to make it work in Lynx/Elinks?
Re:The Accidental Book Review That Made Jack Kerouac Famous
by 3xblah on Tuesday December 17, 2019 @12:50PM
(#21816289)
There is little need for this if one is using a text-only browser such as links/elinks that does not process Javascript or CSS. AMP look great in links/elinks, without any filtering. This is for folks who do not use text-only browsers and prefer to leave Javascript enabled.
Re:The Accidental Book Review That Made Jack Kerouac Famous
by dredmorbius on Tuesday December 17, 2019 @11:57AM
(#21815529)
lynx will read direct from stdin.
<command> | lynx --force-html -stdin
Re:The Accidental Book Review That Made Jack Kerouac Famous
by sogen on Tuesday December 17, 2019 @12:42PM
(#21816171)
thanks! it worked
curl https://www.washingtonpost.com/outlook/the-accidental-book-review-that-made-jack-kerouac-famous/2019/12/13/23e94230-04b3-11ea-b17d-8b867891d39d_story.html\?outputType\=amp |tr -cd '\11\12\15\40-\176' |sed 's/</\n</g' | sed -n '/./{/<p class=.font--body/,/<\/p>/p;}' | lynx --force-html -stdin