Пример #1
0
def _getHtml():
    global LOGIN_COOKIE_FILE
    global __email
    global __password
    
    html = ''
    
    tries = 2
    while (tries > 0):
        try:
            cj = mechanize.LWPCookieJar()
            cj.load(LOGIN_COOKIE_FILE)
            opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(cj))
            req = mechanize.Request(common.URLS['login'])
            for k, v in common.HEADERS.items():
                req.add_header(k, v)
            conn = opener.open(req)
            cj.save(LOGIN_COOKIE_FILE)
            html = conn.read()
            conn.close()
        except:
            log_utils.log(traceback.print_exc())
        
        if html and __email in html:
            break
        else:
            doLogin(__email, __password)
        
        tries -= 1
        
        time.sleep(1)
    
    return html
Пример #2
0
def getUrl(url):
    req = mechanize.Request(url)
    req.add_header(
        'User-Agent',
        ' Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
    )
    response = mechanize.urlopen(req)
    link = response.read()
    response.close()
    return link
Пример #3
0
def VIDEOLINKS(url):
    content = getUrl(url)
    match = re.findall('flashvars.playlist = \'(.*?)\';', content)
    for url in match:
        url = 'http://ua.canna.to/canna/' + url
        content = getUrl(url)
        match = re.findall('<location>(.*?)</location>', content)
        for url in match:
            url = 'http://ua.canna.to/canna/' + url
            req = mechanize.Request('http://ua.canna.to/canna/single.php')
            response = mechanize.urlopen(req)
            req = mechanize.Request(url)
            req.add_header(
                'User-Agent',
                ' Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
            )
            response = mechanize.urlopen(req)
            response.close()
            code = response.info().getheader('Content-Location')
            url = 'http://ua.canna.to/canna/avzt/' + code
            print url
            print '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
            listitem = xbmcgui.ListItem(path=url)
            return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
Пример #4
0
def jahre(url):
    mainurl = 'http://ua.canna.to/canna/'
    req = mechanize.Request(url)
    req.add_header(
        'User-Agent',
        ' Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
    )
    response = mechanize.urlopen(req)
    link = response.read().replace('\n', '')
    response.close()
    match = re.compile(
        '<td align="left" style="border-style:solid; border-width:1px;">.*?<b>(.*?)</b>.*?<b>(.*?)</b>.*?onClick="window.open..(.*?)...CannaPowerChartsPlayer.*?</span>'
    ).findall(link)
    for title1, title2, url in match:
        url = mainurl + url
        title = title1 + ' ' + ':' + ' ' + title2
        title = title.replace(":", "-")
        addLink(title, url, 6, icon)
Пример #5
0
def Index(url):
    mainurl = 'http://ua.canna.to/canna/'
    req = mechanize.Request(url)
    req.add_header(
        'User-Agent',
        ' Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
    )
    response = mechanize.urlopen(req)
    link = response.read().replace('\n', '')
    response.close()
    match = re.findall(
        '<tr>.*?<font>(.*?)</font>.*?class="obutton" onClick="window.open..(.*?)...CannaPowerChartsPlayer.*?</tr>',
        link)
    for title, url in match:
        url = mainurl + url
        print url
        print title
        title = title.replace(":", "-")
        addLink(title, url, 6, icon)
Пример #6
0
def Index1(url):
    if 'jahrescharts' in url:
        icon = iconpath + 'jc_1930.png'
    mainurl = 'http://ua.canna.to/canna/'
    req = mechanize.Request(url)
    req.add_header(
        'User-Agent',
        ' Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
    )
    response = mechanize.urlopen(req)
    link = response.read().replace('\n', '')
    response.close()
    match = re.compile(
        '<b><font face="Arial" size="5" color="#FFCC00"><a href="(.*?)">(.*?)</a></font></b>'
    ).findall(link)
    for url, title in match:
        url = mainurl + url
        print url
        print title
        title = title.replace(":", "-")
        addDir(title, url, 5, icon)