<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<items>
<item>
<title>[COLOR red]•[/COLOR] [B][COLOR white]ELEMENTUM[/COLOR][COLOR none]     $doregex[elementum]  [/COLOR][/B]</title>
<link>$doregex[install]</link>
<thumbnail>https://i.imgur.com/d1ad1Is.png</thumbnail>
<fanart>https://i.imgur.com/mAe2igo.jpg</fanart>
<regex>
<name>elementum</name>
<expres><![CDATA[#$pyFunction#
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcvfs
    import xbmcaddon
    import xbmc
    import os
    import requests
    from bs4 import BeautifulSoup

    HOME = xbmcvfs.translatePath('special://home/')
    ADDONS = xbmcvfs.translatePath(os.path.join(HOME, 'addons'))
    ELEMENTUM_ID = "plugin.video.elementum"
    localPath = os.path.join(ADDONS, ELEMENTUM_ID)
    remoteData = requests.get(
        "https://raw.githubusercontent.com/elgatito/plugin.video.elementum/master/addon.xml").text
    remoteSoup = BeautifulSoup(remoteData, "html5lib")

    if (localPath and xbmc.getCondVisibility('System.HasAddon(%s)' % ELEMENTUM_ID)):
        localVersion = xbmcaddon.Addon(ELEMENTUM_ID).getAddonInfo("version")
        remoteVersion = remoteSoup.find("addon").get("version")
        from distutils.version import LooseVersion
        if LooseVersion(remoteVersion) > LooseVersion(localVersion):
            return "[COLOR orange]ACTUALIZACIÓN REQUERIDA[/COLOR]"
        else:
            return "[COLOR lime]INSTALADO[/COLOR]"

    return "[COLOR red]NO INSTALADO[/COLOR]"

]]></expres>
<page></page>
</regex>
<regex>
<name>platforms</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import os
    import xbmcvfs
    import xbmcaddon
    import xbmcgui
    import platform as plt
    from bs4 import BeautifulSoup

    ADDON = xbmcaddon.Addon()
    ADDONTITLE = ADDON.getAddonInfo('name')
    HOME = xbmcvfs.translatePath('special://home/')
    ADDONS = os.path.join(HOME, 'addons')
    PACKAGES = os.path.join(HOME, 'packages')

    ELEMENTUM_URL = "https://elementum.surge.sh/getting-started/platforms-page/"
    platforms = dict()
    names = list()
    parentLinks = list()
    system = plt.system()

    data = requests.get(ELEMENTUM_URL).text
    soup = BeautifulSoup(data, "html5lib")
    for item in soup.find_all("tr", {"class": "platform-os"}):
        links = list()

        for link in item.find_all(
                "div", {"class": "platform-asset"}):
            links.append({link.text: link.find("a").get("href")})

        platforms[item.find(
            "td", {"class": "platform-name"}).text.strip().replace("OSx", "Darwin")] = links

    for platform, structures in platforms.items():
        for k, v in {key: value for dictionary in structures for key,
                     value in dictionary.items()}.items():
            if platform != system:
                names.append(
                    f"[COLOR red]{platform}[/COLOR] - [COLOR white]{k}[/COLOR]")
            else:
                names.append(
                    f"[B][COLOR orange]{platform} - {k}[/COLOR][/B]")
            parentLinks.append(v)
    option = xbmcgui.Dialog().select("Selecciona tu plataforma", names)
    if option == -1:
        return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return str((parentLinks[option], names[option]))

]]></expres>
<page></page>
</regex>
<regex>
<name>install</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import os
    import xbmcvfs
    import xbmcaddon
    import xbmcgui
    import zipfile
    import time
    import urllib.request
    import xbmc
    import re
    import glob
    from datetime import datetime
    from sqlite3 import dbapi2 as database

    ADDON = xbmcaddon.Addon()
    ADDONTITLE = ADDON.getAddonInfo('name')
    HOME = xbmcvfs.translatePath('special://home/')
    ADDONS = os.path.join(HOME, 'addons')
    PACKAGES = os.path.join(ADDONS, 'packages')
    DATABASE = xbmcvfs.translatePath('special://database/')

    def latest_db(db):
        match = glob.glob(os.path.join(DATABASE, '{0}*.db'.format(db)))
        comp = '{0}(.+?).db'.format(db[1:])
        highest = 0
        for file in match:
            try:
                check = int(re.compile(comp).findall(file)[0])
            except:
                check = 0
            if highest < check:
                highest = check
        return '{0}{1}.db'.format(db, highest)

    def addon_database(addon=None, state=1, array=False):
        dbfile = latest_db('Addons')
        dbfile = os.path.join(DATABASE, dbfile)
        installedtime = str(datetime.now())[:-7]

        if os.path.exists(dbfile):
            try:
                textdb = database.connect(dbfile)
                textexe = textdb.cursor()
            except Exception as e:
                return False
        else:
            return False

        if state == 2:
            try:
                textexe.execute(
                    "DELETE FROM installed WHERE addonID = ?", (addon,))
                textdb.commit()
                textexe.close()
            except:
                pass
            return True

        try:
            if not array:
                textexe.execute(
                    'INSERT or IGNORE into installed (addonID , enabled, installDate) VALUES (?,?,?)', (addon, state, installedtime,))
                textexe.execute(
                    'UPDATE installed SET enabled = ? WHERE addonID = ? ', (state, addon,))
            else:
                for item in addon:
                    textexe.execute(
                        'INSERT or IGNORE into installed (addonID , enabled, installDate) VALUES (?,?,?)', (item, state, installedtime,))
                    textexe.execute(
                        'UPDATE installed SET enabled = ? WHERE addonID = ? ', (state, item,))
            textdb.commit()
            textexe.close()
        except Exception as e:
            pass

    class Extracter(object):
        def __init__(self, name, _in, _out):
            dialog = xbmcgui.DialogProgress()
            dialog.create(name, "")
            self.all(_in, _out, dialog)

        def all(self, _in, _out, dp):

            zin = zipfile.ZipFile(_in,  'r')

            nFiles = float(len(zin.infolist()))
            count = 0

            try:
                for item in zin.infolist():
                    count += 1
                    update = count / nFiles * 100
                    dp.update(int(update))
                    zin.extract(item, _out)
            except Exception as e:
                return False

            return True

    class Downloader(object):
        def __init__(self, url, name, dest) -> None:
            self.URL = url
            self.NAME = name
            self.DEST = dest
            self.start_time = time.time()

            dialog = xbmcgui.DialogProgress()
            dialog.create(self.NAME, "")

            urllib.request.urlretrieve(
                url, dest, lambda nb, bs, fs: self.downloadPercentage(nb, bs, fs, dialog, name))

        def downloadPercentage(self, nb, bs, fs, dialog, name):
            messages = list()
            try:
                percent = min(nb * bs * 100 / fs, 100)
                currently_downloaded = float(nb) * bs / (1024 * 1024)
                kbps_speed = nb * bs / (time.time() - self.start_time)
                if kbps_speed > 0:
                    eta = (fs - nb * bs) / kbps_speed
                else:
                    eta = 0
                kbps_speed = kbps_speed / 1024
                total = float(fs) / (1024 * 1024)
                messages.append(f'[B]Descargando {name}...[/B]')
                messages.append('%.02f MB de %.02f MB' %
                                (currently_downloaded, total))
                messages.append('Velocidad: %.02f Kb/s ' % kbps_speed)
                messages.append('Tiempo: %02d:%02d' % divmod(eta, 60))
                dialog.update(int(percent), "\n".join(messages))
            except Exception as _:
                percent = 100
                dialog.update(percent)
                dialog.close()

            if dialog.iscanceled():
                dialog.close()

    platforms = $doregex[platforms]
    
    dest = os.path.join(xbmcvfs.translatePath(PACKAGES),
                        platforms[0].split('/')[-1])
    Downloader(platforms[0], platforms[1], dest)
    Extracter(platforms[1], dest, ADDONS)
    addon_database("plugin.video.elementum", 1)

    xbmc.executebuiltin('UpdateAddonRepos()')
    xbmc.executebuiltin('UpdateLocalAddons()')
    xbmc.executebuiltin('Container.Refresh()')

]]></expres>
<page></page>
</regex>

</item>
<item>
 Created by Someone Like You 
<title>[COLOR white]•[/COLOR] [B][COLOR red]BUSCADOR[/COLOR][/B]</title>
<link>$doregex[results]</link>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction

def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import requests
    import re
    import difflib
    from bs4 import BeautifulSoup
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")

    inputText = xbmcgui.Dialog().input(
        'Buscar Pelicula: ', type=xbmcgui.INPUT_ALPHANUM).upper()

    for item in list(filter(lambda item: item.find('title') is not None, soup.find_all("item"))):
        title = item.find('title').text.upper()
        ratio = 100 if inputText in title.upper() else difflib.SequenceMatcher(
            None, title, inputText).ratio() * 100
        if ratio < 60:
            continue
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))
]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
<thumbnail>https://i.imgur.com/g412a9y.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
</item>
<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]TODAS[/COLOR][COLOR white]              (A-Z)[/COLOR][/B]</title>
<link>$doregex[results]</link>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    LENGTH_MAGNET = [32, 40]
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in soup.find_all("item"):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))
]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
<thumbnail>https://i.imgur.com/f9tpAmE.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
</item>


<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]CALIDAD[/COLOR][COLOR white]          MICROHD, BDRIP, 3D, 4K[/COLOR][/B]</title>
<thumbnail>https://i.imgur.com/3I3skgB.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
<link>$doregex[qualities]</link>
<regex>
<name>qualities</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][qualities.param2][/COLOR][/B]</title>
<link>$doregex[results]</link>
<thumbnail>https://i.imgur.com/3I3skgB.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    qualities = list()

    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in soup.find_all("item"):
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                if child.name not in qualities:
                    qualities.append(child.name)

    return list(sorted([(quality, quality.replace('microhd', 'Micro HD').replace(
        'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K')) for quality in qualities], key=lambda quality: quality[1]))

]]></expres>
<page></page>
</regex>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    quality = "[qualities.param1]"
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in list(filter(lambda it: it.find(quality) is not None and re.match(
            r'^[0-9a-fA-F]{40}$', it.find(quality).text), soup.find_all("item"))):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))

]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + links.get("[qualities.param1]")

]]></expres>
<page></page>
</regex>
</item>


<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]AÑO[/COLOR][/B]</title>
<thumbnail>https://i.imgur.com/eyTvbyC.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
<link>$doregex[years]</link>
<regex>
<name>years</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][years.param1][/COLOR][/B]</title>
<link>$doregex[results]</link>
<thumbnail>https://i.imgur.com/eyTvbyC.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    years = list()

    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in soup.find_all("item"):
        date = item.find('date')
        if date is not None:
            if item.find('date').text not in years:
                years.append(item.find('date').text)
    return list(sorted(years, reverse=True))
]]></expres>
<page></page>
</regex>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    year = "[years.param1]"
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in list(filter(lambda it: it.find("date") is not None and it.find("date").text == year, soup.find_all("item"))):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))

]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
</item>


<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]GENERO[/COLOR][COLOR white]           ACCION, DRAMA, SAGAS, ...[/COLOR][/B]</title> 
<thumbnail>https://i.imgur.com/E2xELih.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
<link>$doregex[genres]</link>
<regex>
<name>genres</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][genres.param1][/COLOR][/B]</title>
<link>$doregex[results]</link>
<thumbnail>https://i.imgur.com/eyTvbyC.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import unicodedata
    from bs4 import BeautifulSoup
    genres = list()

    def strip_accents(s):
        return ''.join(c for c in unicodedata.normalize('NFD', s)
                       if unicodedata.category(c) != 'Mn')
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(strip_accents(data), "html5lib")
    for item in soup.find_all("item"):
        genreItem = item.find('genre')
        if genreItem is not None:
            for genre in [genre.strip() for genre in genreItem.text.split('.')]:
                if not genre in genres:
                    genres.append(genre)
    return list(filter(lambda item: item and item != 'NA', sorted(genres)))
]]></expres>
<page></page>
</regex>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    genre = "[genres.param1]"
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in list(filter(lambda it: it.find("genre") is not None and genre in it.find("genre").text, soup.find_all("item"))):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))
]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
</item>

<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]CINE DE[/COLOR]    [COLOR white]        CULTO[/COLOR][/B]</title>
<thumbnail>https://i.imgur.com/Hmc87sC.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
<link>$doregex[results]</link>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    extra = "Culto"
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in list(filter(lambda it: it.find("extra") is not None and it.find("extra").text == extra, soup.find_all("item"))):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))

]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
</item>
<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]CINE DE[/COLOR]    [COLOR white]        ESTRENO[/COLOR][/B]</title>
<thumbnail>https://i.imgur.com/vX0Ycn6.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
<link>$doregex[results]</link>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    extra = "Estreno"
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in list(filter(lambda it: it.find("extra") is not None and it.find("extra").text == extra, soup.find_all("item"))):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))

]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
</item>

<item>
<title>[COLOR white]•[/COLOR] [B][COLOR red]CINE DE[/COLOR]    [COLOR white]        MISCELANEA[/COLOR][/B]</title>
<thumbnail>https://i.imgur.com/vIX7Cnq.png</thumbnail>
<fanart>https://i.imgur.com/R7oMOZO.jpg</fanart>
<link>$doregex[results]</link>
<regex>
<name>results</name>
<listrepeat><![CDATA[
<title>[COLOR red]•[/COLOR] [B][COLOR white][results.param1][/COLOR][/B]</title>
<link>$doregex[selectionLinks]</link>
<year>[results.param4]</year>
<genre>[results.param5]</genre>
<info>[results.param6]</info>
<thumbnail>[results.param2]</thumbnail>
<fanart>[results.param3]</fanart>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import requests
    import re
    from bs4 import BeautifulSoup
    extra = "Mis"
    VALID_TAGS = ['title', 'thumbnail', 'fanart',
                  'date', 'genre', 'info', 'links']

    matches = list()
    data = makeRequest('https://raw.githubusercontent.com/830NY/tacones_publico/main/cine.xml$$KonectasEncKey=Tacones$$')
    soup = BeautifulSoup(data, "html5lib")
    for item in list(filter(lambda it: it.find("extra") is not None and it.find("extra").text == extra, soup.find_all("item"))):
        data = dict()
        links = list()
        for child in item.children:
            if (child.name is not None and re.match(r'^[0-9a-fA-F]{40}$', child.text)):
                links.append({child.name: child.text})
            elif (child.name in VALID_TAGS):
                data[child.name] = child.text

        if len(links) == 0:
            continue
        data['links'] = str(links)
        matches.append(tuple(
            dict(sorted(data.items(), key=lambda x: VALID_TAGS.index(x[0]))).values()))
    return list(sorted(matches, key=lambda film: film[0]))

]]></expres>
<page></page>
</regex>
<regex>
<name>selectionLinks</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data, Cookie_Jar, m):
    import xbmcgui
    import xbmcaddon
    ADDON = xbmcaddon.Addon()
    dialog = xbmcgui.Dialog()
    links = {key: value for dictionary in [results.param7] for key,
             value in dictionary.items()}
    option = 0
    if len(links) > 1:
        option = dialog.select('Seleccione Calidad:', [quality.replace('microhd', 'Micro HD').replace(
            'fullhd', 'Full HD').replace('tresd', '3D').replace('cuatrok', '4K') for quality in links.keys()])
        if option == -1:
            return xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), "Selección cancelada", ADDON.getAddonInfo('icon'))
    return 'plugin://plugin.video.elementum/play?uri=magnet:?xt=urn:btih:' + list(links.values())[option]

]]></expres>
<page></page>
</regex>
</item>
</items>
  
