Small bash command to download all of Tofugu's grammar section for offline use

Finally in Japan (Kansai) after all these years of wanting to come ! :confetti_ball:

I wrote the following bash command to get all of Tofugu’s grammar section to read offline in the long plane rides. I was thinking it could be of service to someone else, so here it is.

wget \
    --recursive \
    --level 5 \
    --no-clobber \
    --page-requisites \
    --adjust-extension \
    --span-hosts \
    --convert-links \
    --restrict-file-names=windows \
    --domains tofugu.com \
    --no-parent \
    "https://www.tofugu.com/japanese-grammar/"

To run this, copy-paste it into a terminal with the wget command (most should have it; this is a Unix-friendly version of this script, it might need some changes for some windows shells) while connected to the internet. It’ll take a while to run this script, as it downloads everything.

It will create a couple of folders called

files.tofugu.com
www.tofugu.com

If you go look for the files called index.html in the www folder, and open them with the browser of your choice, it’ll read them like it would read the normal website. Clicking on any links in the page will also follow the right path, on the local (offline) version of the website.

Enjoy !

8 Likes

I was trying to remember the app I used a million years ago for offline browsing (Instapaper) and came across this article on tools for the purpose, including wget. Httrack looks interesting.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.