09 September, 2018 - 2 min read

Over the last weekend, I created Referancy. A basic Python 3 script to create referral links for markdown driven sites. For example this blog. The script needs a file with URLs and then prompts you to insert the blog name to create the referral part of the URL.
It then puts out a new file with the referral links already in markdown format. E.g. the URL example.com with my page as a referral will then be example.com?ref=niklasmtj.de.


Basic usage is ./referancy.py -i <inputfile> -o <outputfile>. You can also get this example by typing ./referancy.py -h. Python 3+ has to be installed on your machine to execute this script.

The file takes an input file e.g. examplein.md with the URLs used in the blog post for example:


Referancy then asks you to type in your blog name or hostname to create the referral links. The output file will then be created if it not already exist. They are formatted in the basic markdown link format. To create a link description you have to change the [] with () and put the description in brackets [] before the link.
E.g [Example description](example.com?ref=niklasmtj.de).

This is only the first step. I want to change this script to scrape a blog post draft and change the found URLs to referral links. Without using the input- and output-files to copy & paste the URLs one by one.
Referancy is my first little project of learning Python which is also a language I really would love to learn.

You can check the script on GitHub: https://github.com/niklasmtj/referancy