Scrape Notion and convert into PDF
I love VanGohan, who is a Japanese meal kits provider in Vancouver. Their meal kits are really tasty and authentic Japanese foods. I can’t live without them. When I visited Japan last year, I wasn’t too eager to find nice Japanese restaurants because of them.
Recipe on Notion is good, if it’s printable
They provide a recipe on Notion. Seeing the recipes on it is great since they can fix recipes quite quickly.
However, there’s one caveat of Notion. They don’t provide printable pages. It’s super annoying to copy and past the recipes to the memo app, and print it out. I asked Notion’s support team, but they answered it isn’t a prioritized item implicitly.
Ok, it’s automation time!
Scrape Notion with Python
I chose Selenium and it works like a charm.
Here is the GitHub repository:
They key takeaways are:
chromedriver-autoinstallerpackage is useful to avoid extra efforts of Chrome driver installation.
- Selenium is easy enough to export PDF code.
- Running the script on GitHub Actions is easy. Don’t forget to install fonts if it’s not English page.
Originally, I thought I had to prepare a Docker image, but I was aware it was not mandatory. Managing a Docker image for this kind of hobby script would be costly. So, I’m going to keep this approach and will look back if it is the right way.
Currently, I scheduled the GitHub Actions workflow. It will update the PDFs on the repository automatically.
Edit: Now I use Cloudflare Pages to host the PDFs. You can check at https://vangohan.chezo.uno/.
No Python environment on a local machine is needed anymore.
Yay, automation is completed! 😁