HomeRaspberry PiMagPi - auto-downloader

MagPi – auto-downloader

Grab each edition of Mag Pi as soon as possible!

MagPi notification

MagPi – auto-downloader is designed to notify your when the new magazine is available as a PDF. Why should you care about it? This is a great source of inspiration if you are familiar with the RPI already, or a great way to get you going if you are new to the RPI. Either way, the MagPi can be free if you decide to use PDF file only. Each month the file is uploaded to the server, but since the dates aren’t fixed, simple calendar reminder won’t work. The fun way of doing this is getting the Raspberry Pi to notify us about the new issue of the Mag Pi.

There are other alternatives to get the magazine as well.  These are various ways you could obtain your copy of MagPi:

  • Periodically check the https://www.raspberrypi.org/magpi/issues/
  • Sign up for a newsletter and you will get weekly updates including mentions when MagPi is out!
  • Download the app, and pay the subscription fee, to receive your MagPi as soon as it is available!
  • Subscribe and get the paper copy of the magazine delivered to your doorstep!
  • Follow @TheMagp1 on Twitter
  • You can follow this tutorial and hire your Raspberry Pi to do the job for you.

Requirements for MagPi auto-downloader

In this scenario, we will be sending the PDF download instructions to an Android device. Apart from phone or tablet, Raspberry PI, we will also need few things.

[appbox googleplay net.dinglisch.android.taskerm]
[appbox googleplay com.joaomgcd.autoremote]

To install this, please open the terminal and use:

sudo apt-get install python3-pip
pip install requests
sudo apt-get install python3-bs4

The script and the Tasker project:

You will have to connect AutoRemote to the Raspberry Pi, and you are in luck as I already have the tutorial for you. Click here to set it up. The script checks each day if the new issue is available then notifies the device via AutoRemote.

To check if a new issue is available I use parsed details from the website. If a new entry is found, the link is composed and sent to your phone.

PYTHON 2: Magpi.py
import requests
import os
import pickle
from bs4 import BeautifulSoup, SoupStrainer
import urllib.request

Authentication keys enter your keys
auth_key_mob = 'YOUR_KEY_GOES_HERE'
auth_key_pc = 'YOUR_KEY_GOES_HERE'
auth_key_tab = 'YOUR_KEY_GOES_HERE'

#Function that sends the Autoremote to the desired device

message = ''
def send_AR(message, auth_key):
	url_mobile = 'https://autoremotejoaomgcd.appspot.com/sendmessage?key=' + auth_key + '&message='
	ar_message = url_mobile + message
	with urllib.request.urlopen(ar_message) as url:
		s = url.read()
#variables that we are going to use 

url = 'https://www.raspberrypi.org/magpi-issues/'
file_type = '.pdf'
response = requests.get(url)
dictLibraryOLD = {}
dictLibraryNEW = {}

#open last session - open it as OLD dictionary

	with open('magpies.pickle', 'rb') as pilist:
		dictLibraryOLD = pickle.load(pilist)
except IOError:
	print('can\'t open')
#look up a href links and create a dict, k = MagPi no v = link

	for link in BeautifulSoup(response.content, 'html.parser', parse_only=SoupStrainer('a')):
		if link.has_attr('href'):
			if file_type in link['href']:
				full_path = url + link['href']
				name = link['href']
				dictLibraryNEW[name] = full_path
	if len(dictLibraryOLD) == 0:
		print ('empty dictionary')
		#save current list to the file to be used as the next OLD dictionary
		with open('magpies.pickle', 'wb') as pilist:
			pickle.dump(dictLibraryNEW, pilist)
		#Compare 2 dictionaries and list the differences
		for key in dictLibraryNEW.keys():
			if not key in dictLibraryOLD:
				messageMobile = url + key + '=:=' + key
				send_AR(messageMobile, auth_key_mob)			
		with open('magpies.pickle', 'wb') as pilist:
			pickle.dump(dictLibraryNEW, pilist)
Profile: MagPi Available 

Event: AutoRemote [ Configuration:MagPi ]
Enter: Download Pi (11)

	A1: Variable Set [ Name:%MagPiurl To:%arpar1 Do Maths:Off Append:Off ]
	A2: AutoNotification [ Configuration:Use HTML: false
		Title: New issue of MagPi is available!
		Text: Expand to download %arcomm
		Action on Touch: Closeandwait
		Url: %arpar1
		Icon: android.resource://net.dinglisch.android.ipack.bluewhitepearlhd/creditcard2
		Status Bar Icon: ic_action_book
		Status Bar Text Size: 16
		Id: 314
		Is Group Summary: false
		Title Expanded: Touch and download now %arcomm
		Skip Picture Cache: false
		Text Expanded: Touch to download now!
		Button 1: Download
		Label 1: Download
		Icon 1: av_download
		Update Notification: false
		Only on Phone: false Timeout (Seconds):20 ]
Profile: On Touch 

Event: AutoApps Command [ Configuration:Command Filter: Download
	Case Insensitive: false
	Exact: false
	Regex: false
	Variable Array: false ]
Enter: Close Magpi 

	A1: AutoNotification Cancel [ Configuration:Id: 314
		Cancel All: false Timeout (Seconds):0 ]
	A2: Browse URL [ URL:%MagPiurl ]
	A3: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
	A4: Go Home [ Page:0

Schedule it!

Now that we have this sorted, time to schedule the job. We will use cron to execute the script once a day. MagPi comes out on various days, once a month. To get the timely notification we need to check for the new issues every day!
To set the schedule of MagPi – auto-downloader open the cron:

crontab -e

and add the line:

0 1 */1 * * python3 /path/to/your/file/MagPi_watcher.py &

Cron takes the commands that are structured in the following way: * * * * * command /path & – if you want it in the background. (*/1 = in a daily interval, & means run in the background)
Each * is responsible for a timer:

Crontab Scheedule
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)

And this is it. Your RPI will check for a new edition of MagPi each day at 1:00AM and will push notification via Tasker! When the download is clicked, a pdf file will be saved to your default download location.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU


Programable, ESP32 based awesome dev platform with 4.7 e-ink display by M5Stack

More HATs


Argon One M.2

Enclose Raspberry Pi 4 inside this great case with custom I/O, cooling and GPIO and M.2 SSD support

More cases on


Best Raspberry Pi Projects

How to use Raspberry PI as WOL (wake on lan) server

While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

Slow Internet Warning

From time to time my Internet grinds to a stop. Since Raspberry Pi 4 comes with a 1Gbps Ethernet, I decided to take advantage of it and create a reporting system in NodeRED that will monitor and report when the ISP is not keeping the contractual agreements. Works with Alexa, Google Home, Android and Windows 10.

How fast Raspberry Pi NAS is?

Let's see how fast Raspberry Pi NAS really is?

Argon18: Argon ONE SSD modification

Argon One case just got better - now you can boot it from USB without ruining the design thanks to Argon 18: Argon One SSD modification


It took me 2 months to boot CM4 from NVMe

Complete beginners guide to Compute Module 4 boot from NVMe.

Raspberry Pi Zero 2 W vs other Zero boards

It's time to test the Raspberry Pi Zero 2 W against other Raspberry Pi boards from Zero series: power, WiFi, temperature and core performance

C/C++ and MicroPython SDK for Raspberry Pi Pico on Windows

A guide to SDK toolchain for Raspberry Pi Pico and C/C++ , Micropython on Windows.

A comprehensive guide to Grafana & InfluxDB

How to use Grafana and InfluxDB on Raspberry Pi for IoT sensors in home automation

How to boot Raspberry Pi 4 from USB

How to set up and boot Raspberry Pi 4 from USB drive - headless guide.