The Business Times of Singapore is a leading English language business and financial newspaper. With a valid subscription, you will get full access to their print edition of their newspaper in PDF format on both Android and IOS devices.
Without a subscription, you will not get access to the print edition, well….sort of. Actually, even without a subscription, there is a way to download The Business Times print edition in PDF format for free on your desktop computer. This is similar to the way we download the PDF files of The Straits Times newspaper.
For this hack, you will need the following tools.
- A Linux PC workstation. You can also run Linux on a virtualised environment. Else, install Cygwin on Windows.
- curl utility – to retrieve the JSON data.
- jq utility – a lightweight JSON processor. This is to decode the JSON output.
- wget utility – to download the PDF files.
Open a shell terminal, and run curl as follows.
1 2 |
$ today=$(date +"%Y%m%d") $ curl -s -H "Authorization: ZHVtbXk=" "http://pdf.businesstimes.com.sg/bt/pdfFile/date/$today" |
1 2 3 4 5 |
$ today=$(date +"%Y%m%d") $ user="btapi:bt0407" $ ua="Apache-HttpClient" $ bt_url="http://pdf.businesstimes.com.sg/mobileapi/api/pdf/date/$today" $ curl -su "$user" --basic -A "$ua" "$bt_url" |
The variables “today
“, “user
” and “ua
” contain today’s date, username/password and the user-agent string respectively. They will be used by the curl
utility to retrieve the JSON data for the current day.
If you analyse the JSON data, the PDF file names are available under the “pdfs
” array section. The URL to the files can be retrieved from the “url
” field.
To download all the PDFs in one go, try running the shell script below. The script will generate URLs for all the PDFs and will use the wget
utility to download the files. The script is similar to the one used to download The Straits Times newspaper.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#!/bin/sh today=$(date +"%Y%m%d") user="btapi:bt0407" ua="Apache-HttpClient" bt_url="http://pdf.businesstimes.com.sg/mobileapi/api/pdf/date/$today" curl -su "$user" --basic -A "$ua" "$bt_url" | \ jq -r '."SPH-BT"[] | .url + " " + .pdfs[]' | \ while IFS= read line ; do set -- $line infile="$1$2" outfile="$2" wget $infile -O "$outfile" done |
Update (1-Oct-2015): Article updated with new procedure. Previous URLs and methods no longer work.
Update (23-Apr-2016): Article updated with new download link and script.
Note (23-Apr-2016): This article will no longer be updated.
Related: How to Download The Straits Times Print Edition in PDF for Free