Home Addon Development Create Your Own Kodi Addons with Audrey Framework and JSON

Create Your Own Kodi Addons with Audrey Framework and JSON


Guest post by ptom98, scroll to the bottom for video tutorials: Almost every Kodi addon user I know has at some point thought to themselves “I wish there was an addon for X site”. Unfortunalty sitting down and creating a Kodi addon can be a timely process and that’s even if you’ve got an understanding of Python, if you haven’t then you’ve got to factor in the time and learning curve of learning a programming language and understand how to scrape a website.

However now, with the help of Audrey creating an addon can be done quickly and simply without any programming knowledge, and then when you’re completed just enter some simple details into Kodi and you’ll end up with an installable Kodi addon. All this is achieved through a JSON file, which specifies what site to crawl, what to look for as well as some other features such as searching and tag filtering.

Audrey is spread over three addons:

icon1 300x300 150x150 - Create Your Own Kodi Addons with Audrey Framework and JSONAudrey Script (script.module.audrey) – This will automatically install in the background (if you don’t already have it installed) when any addon created with Audrey is installed. This reads in your JSON and turns it into an addon for you.


icon1 1 300x300 150x150 - Create Your Own Kodi Addons with Audrey Framework and JSONAudrey Tester (plugin.video.audreytester) – Used for testing your JSON and creating an installable zip file when finished. When run with your JSON it will function the same as your exported addon.


icon1 2 300x300 150x150 - Create Your Own Kodi Addons with Audrey Framework and JSONAudrey Demo (plugin.videoaudreydemo) – This is simply a demo yo show what is possible. All the JSON files are viewable online (check the forum for links) so you can have a look and see how exactly they work. The demo pulls content from: YouTube.com, FunnyorDie.com and WatchDust.com.

As mentioned Audrey uses a JSON file to gather information on the site(s) you wish to scrape for content, it uses search patterns within this JSON file to scrape content from these sites and once video content has been found it uses the URLResolver addon to play the content back within Kodi.The JSON file can either be stored locally on your machine or stored online. I use jasonbase.com to store the demo content, it’s a reliable and free service.

The Search Patterns work similar to a Regular Expression, however they have been greatly simplified. In our search patterns we just use {%} and {*}.

Using the simple example below I’ll show you how to create a search pattern to extract content from it.

<!DOCTYPE html>
    <div class="film">
            <a href="http://mywebsite.com/myfilm">
            <h2>The Title of my Film</h2>
            <img src="http://mywebsite.com/myfilm/image.jpg" />
            <p>A short description of my film</p>
        <div class="film">
            <a href="http://mywebsite.com/myfilm2">
            <h2>The Title of my Film2</h2>
            <img src="http://mywebsite.com/myfilm2/image.jpg" />
            <p>A short description of my film2</p>

So, the Search Pattern below will pull the links, title, image and description which from the above content.

<div class="film">{*}href="{%}"{*}<h2>{%}</h2>{*}src="{%}"{*}<p>{%}</p>

{%} is a snippet of html that we want and can be referenced within the JSON file as {%1}, {%2} etc
{*} is html that we want to ignored

The above search pattern would search the content for <div class=”film”> then ignore any content after this until it reaches href= then it would store everything between the speech marks as the first snippet (references as {%1}).
It would then ignore all html until it reached a <h2> whereby it would the content between <h2> and </h2> as the second snippet (referenced as {%2}).
Next it would ignore all content until it reaced src= where it would store the content between the speech marks as snippet (referenced as {%3} finally it would then ignore all content until it reaches a <p>, whereby it will store the content between <p> and </p> as snippet 4 (referenced as {%4}.

This would retrieve the following snippets:

{%1} – http://mywebsite.com/myfilm
{%2} – The Title of my Film
{%3} – http://mywebsite.com/myfilm/image.jpg
{%4} – A short description of my film

{%1} – http://mywebsite.com/myfilm2
{%2} – The Title of my Film2
{%3} – http://mywebsite.com/myfilm2/image.jpg
{%4} – A short description of my film2

We can then use this in our JSON file to represent details to be displayed in Kodi, in this case {%1} is the link to the page containing the video content, {%2} is the title of the content, {%3} is the image to be used and {%4} is the plot.

Now you have an understanding how the Search Patterns work, we can go over the structure of the JSON file. A JSON file is in a simplest sense a means of storing data in a readable format. Here I’ll cover whats needed for the very basics of addon, for a more extensive explanation have a read through the forum post here.

If we take the example search patterns above, we can turn this into a (albeit non functioning) addon, simply by using the JSON below.

    "sites": [
            "name": "Example Addon",
            "poster": "http://mywebsite.com/poster.jpg",
            "fanart": "http://mywebsite.com/fanrt.jpg",
            "items": {
                "Latest": [
                        "site_url": "http://mywebsite.com",
                        "pattern": "<div class=\"film\">{*}href=\"{%}\"{*}<h2>{%}</h2>{*}src=\"{%}\"{*}<p>{%}</p>",
                        "name": "{%2}",
                        "url": "{%1}",
                        "plot": "{%4}",
                        "poster": "{%3}",
                        "fanart": "{%3}"

As you can see from the above JSON we’ve taken the search pattern and escaped the speechmarks and then put the snippets into the relevant parts.

So taking what we know so far you can use this to build a very simple YouTube Playlist addon. If we take the playlist of tutorials for the Audrey addon at https://www.youtube.com/playlist?list=PLlrPf5RpnpTsDItBmdIM_0Y1OfKjO3kAn for the content, if you view the HTML you’ll see that the content we need is all stored within a table. We can use this table as our Global Search Pattern. The Global Search pattern allows us to search a specific area of the HTML rather than the whole of the page.

The Global Search Pattern for this page would look like this:

<table id="pl-video-table" class="pl-video-table">{%}</table>

As you can see with a global search pattern, only one snippet is needed, this snippet is the content we will apply the Search Pattern to.

So again looking at the HTML source for the page you can now write the search pattern, which will look like this:


The above search pattern will give us the following results

{%1} – The YouTube video title
{%2} – The YouTube video page link
{%3} – The YouTube video image path

Using the above two search patterns we can then add this into our JSON:

    "sites": [
            "name": "Audrey Tutorials",
            "poster": "",
            "fanart": "",
            "items": {
                "Latest": [
                        "site_url": "https://www.youtube.com/playlist?list=PLlrPf5RpnpTsDItBmdIM_0Y1OfKjO3kAn",
                        "global": "<table id=\"pl-video-table\" class=\"pl-video-table\">{%}</table>",
                        "pattern": "data-title=\"{%}\"{*}href=\"{%}\"{*}data-thumb=\"{%}\"",
                        "name": "{%1}",
                        "url": "http://youtube.com{%2}",
                        "poster": "{%3}",
                        "fanart": "{%3}"

If you copy the above code and save this down either to a local file or to an online service like jasonbase.com and then load it into Audrey Tester via the addons settings, you will now see a list of tutorials showing you in more depth how to use Audrey.

screenshot011 - Create Your Own Kodi Addons with Audrey Framework and JSONscreenshot012 - Create Your Own Kodi Addons with Audrey Framework and JSON

So in just 21 lines we’ve got a fully working addon, which will update as and when videos are added to the YouTube playlist. Once this is completed we can create an installable addon which can be installed on any Kodi device.

To do this all you need to do is open the settings for Audrey Tester, navigate to Create Addon and enter the following information; the location you want the finished .zip file to be saved, the name you want to call your addon, the version number, a summary and description, author details and finally fanart and an icon.

screenshot013 - Create Your Own Kodi Addons with Audrey Framework and JSON

Once everything is completed, enable Create Addon on Next Run, click OK and run the Audrey Tester addon. If everything goes correctly, instead of running the addon this time it will show dialog telling that your addon has been created in your desired save location.

screenshot014 - Create Your Own Kodi Addons with Audrey Framework and JSON

This zip file can now be installed as you would any other Kodi addon zip file.

Instructional Videos

Have a Question? Visit our Discussion Forums Today! There's always someone who's eager to be of assistance. Praise is always appreciated as well.

Please remember that our community is supported entirely by volunteers, developers are not paid and updates to their Kodi addons are made during their free time.