def get_cached_url(self, url, data='', cache_limit=8):
    try:
        dbcon = database.connect(control.sourcescachedUrl)
        dbcur = dbcon.cursor()

        #dbcur.execute(
        #    "CREATE TABLE IF NOT EXISTS rel_url (""source TEXT, ""imdb_id TEXT, ""season TEXT, ""episode TEXT, ""rel_url TEXT, ""UNIQUE(source, imdb_id, season, episode)"");")
        dbcur.execute(
        "CREATE TABLE IF NOT EXISTS url_cache (url VARCHAR(255) NOT NULL, data VARCHAR(255), response, res_header, timestamp, PRIMARY KEY(url, data))")
    except:
        pass

    try:
        if data is None: data = ''
        html = ''
        res_header = []
        created = 0
        now = time.time()
        age = now - created
        limit = 60 * 60 * cache_limit
        dbcur.execute('SELECT timestamp, response, res_header FROM url_cache WHERE url = %s and data=%s' % (url,data))
        rows =  dbcur.fetchall()
        control.log('DB ROWS: Url: %s, ' % (rows))

        if rows:
            created = float(rows[0][0])
            res_header = json.loads(rows[0][2])
            age = now - created
            if age < limit:
                html = rows[0][1]
        control.log('DB Cache: Url: %s, Data: %s, Cache Hit: %s, created: %s, age: %.2fs (%.2fh), limit: %ss' % (
        url, data, bool(html), created, age, age / (60 * 60), limit))
        return created, res_header, html
    except:
        return
dataset/ETHPy150Open mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/cache.py/get_cached_url/original