WIP Edge videos of the most complex and sophisticated minds at KODI
Hi all,

Before I go to real issue, you might think that I'm new to Kodi but in fact been a supporter of XBMC since ages and I'm forever grateful to the community who is working to make Kodi what is it. Awesome. Maybe this post is not for here but I was feared that If I post at Scrappers nobody would notice (why would you reply to a new forum user anyway Smile

I use Edge.org website very often to educate myself on science and exploration beyond what we see around us. Its a fantastic non-commercial initiative (disclaimer: I am only the fan and not affiliated). Since they have every week different thinkers to discuss in a video different aspects I thought to create an add-on for Kodi Jarvis.

The link where all videos are displayed (in Vimeo hidden format) is: https://www.edge.org/videos

I've started to build a scraper and hence I need your advice and help from experienced users.

addon.xml looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.edgevideos" name="Edge Org Videos" version="0.0.1" provider-name="spoyser">
    <import addon="xbmc.python" version="2.1.0"/>
  <extension point="xbmc.python.pluginsource" library="default.py">
  <extension point="xbmc.addon.metadata">
    <summary>Edge Org Videos</summary>
    <description lang="en">Videos from Edge.</description>

While python script default.py I tried to base similar to 80s music videos addon script
import urllib
import re
import xbmc
import xbmcaddon
import xbmcplugin
import xbmcgui
import os
import geturllib

ADDON   = xbmcaddon.Addon()
TITLE   = 'Edge.org Videos'
VERSION = '0.0.1'
DIR     = 'plugin.video.edgevideos'

_PLAY   = 100
_LETTER = 200
_YEAR   = 300

def main():  
    addDecade('edge', 'http://www.edge.org/')

def addDecade(year, url):
    thumbnail = 'DefaultPlaylist.png'
    u         = sys.argv[0]
    u        += "?url="  + urllib.quote_plus(url)
    u        += "&mode=" + str(_YEAR)
    liz       = xbmcgui.ListItem(year, iconImage=thumbnail, thumbnailImage=thumbnail)

    xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = liz, isFolder = True)

def checkVersion():
    prev = ADDON.getSetting('VERSION')
    curr = VERSION

    if prev == curr:

    #new version, inform user of new features
    ADDON.setSetting('VERSION', curr)

    if prev == '0.0.0':
        d = xbmcgui.Dialog()
        d.ok(TITLE, '', 'Now with 90s Edge Videos')

def addLetters(url):
    for i in range(65, 91):
        addLetter(url, chr(i))

def addLetter(url, letter):
    thumbnail = 'DefaultPlaylist.png'
    u         = sys.argv[0]
    u        += "?letter=" + letter
    u        += "&mode="   + str(_LETTER)
    u        += "&url="    + urllib.quote_plus(url)
    liz       = xbmcgui.ListItem(letter, iconImage=thumbnail, thumbnailImage=thumbnail)

    xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = liz, isFolder = True)

def addItem(url, item):
    items = item.split('&a=a">')
    root  = items[0]
    title = items[1]

    url += 'vid/' + root + '.flv'

    thumbnail = 'DefaultPlaylist.png'
    u         = sys.argv[0]
    u        += "?url="   + urllib.quote_plus(url)
    u        += "&title=" + urllib.quote_plus(title)
    u        += "&mode="   + str(_PLAY)
    liz       = xbmcgui.ListItem(title, iconImage=thumbnail, thumbnailImage=thumbnail)  


    xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = liz, isFolder = False)

def requestLetter(url, letter):
    response = geturllib.GetURL(url, 60*60*24) # 1 day

    r     = 'vid=(.+?)</a>'
    match = re.compile(r).findall(response)

    for item in match:
        if item[0].upper() == letter:
            addItem(url, item)

def play(url, title):    
    pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)

    liz = xbmcgui.ListItem (title)

    liz.setInfo( type="Video", infoLabels={ "Title": title} )

    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)

    #pl.add(url, liz)

def get_params():
    param       = []
    paramstring = sys.argv[2]
    if len(paramstring) >= 2:
        params        = sys.argv[2]
        cleanedparams = params.replace('?','')

        if params[len(params)-1] == '/':
           params = params[0:len(params)-2]

        pairsofparams = cleanedparams.split('&')
        param         = {}

        for i in range(len(pairsofparams)):
            splitparams = {}
            splitparams = pairsofparams[i].split('=')

            if len(splitparams) == 2:
                param[splitparams[0]] = splitparams[1]
    return param

geturllib.SetCacheDir(xbmc.translatePath(os.path.join("special://profile", "addon_data", DIR,'cache')))

params = get_params()
mode   = None
url    = None



if mode == None:

elif mode == _PLAY:  
        title = urllib.unquote_plus(params["title"])  
        play(url, title)

elif mode == _LETTER:
        letter = urllib.unquote_plus(params["letter"])
        requestLetter(url, letter)

elif mode == _YEAR:

I dont have Github account but I encourage someone to start this addon to bring Edge quality conversations inside Kodi.

I use Raspberry PI with OpenElec, and happy to contribute, donate for fantastic work you are doing.

Lets do this!!!! Angel
Thank you in advance everyone!!!!!

p.s. I promise to be an active user to test, report and further develop Kodi addons. Dont pay attention that this is my first post, I got to start from somewhere Smile

#Update 1: There is a workaround if you install Vimeo Addon and you go to Edge website to "like" the video. It does not appear as video is listed as private, so maybe video scrapper can play what is in web-browser.
Here ya go...

Edge.org - v 0.0.6

I've tested on Linux (Ubuntu 12.04 & Lubuntu 14.04), Mac OS (Lion), and Android (Lollipop), running Gotham, Helix, and Isengard, and experienced no issues.

To do list:
  • Thumbnails and descriptions for each video
  • Ability to browse videos by year
  • Option in settings to choose stream bitrate

If you have any issues with the add-on, please post a log (wiki).
Kodi 17.6 on Dell Optiplex 980 Lubuntu 18.04 | Kodi 19 on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo

Logout Mark Read Team Forum Stats Members Help
Edge videos of the most complex and sophisticated minds at KODI1
This forum uses Lukasz Tkacz MyBB addons.