Exemplo n.º 1
0
elif mode == 'plinkettreviews':
    url = addon.queries['url']
    html = get_http_error(url)

    match = re.compile('<td.+?<a href="(.+?)".+?img src="(.+?)"').findall(html)
    for link, thumb in match:
        name = re.search("[http://]*[a-z./-]*/(.+?)/",
                         '/' + link).group(1).replace('-', ' ').replace(
                             '/', ' ').title()

        if re.search('http', link):
            newlink = link
        else:
            newlink = url + link
        addon.add_video_item({'url': newlink}, {'title': name}, img=thumb)

elif mode == 'halfbag':
    url = addon.queries['url']
    html = get_http_error(url)

    match = re.compile(
        '<td width=270><a href="(.+?)" ><img src="(.+?)"></a></td>').findall(
            html)

    episodenum = 1
    for link, thumb in match:
        addon.add_video_item({'url': link},
                             {'title': 'Episode ' + str(episodenum)},
                             img=thumb)
        episodenum += 1
Exemplo n.º 2
0
    url = MovieUrl
    html = net.http_GET(url).content

    match = re.compile(
        '''<a onclick='visited.+?' href=".+?" target=.+?<div>(.+?)</div>''',
        re.DOTALL).findall(html)
    for name in match:
        latestlist.append(name)

    #convert list to a set which removes duplicates, then back to a list
    latestlist = list(set(latestlist))

    for movie in latestlist:
        addon.add_video_item(
            {
                'url': MovieUrl,
                'section': 'latestmovies',
                'video': movie
            }, {'title': movie})

elif mode == 'moviespopular':
    url = MainUrl
    html = net.http_GET(url).content
    match = re.compile('''<td align="center"><a href="(.+?)">(.+?)</a></td>''',
                       re.DOTALL).findall(html)

    # Add each link found as a directory item
    for link, name in match:
        is_movie = re.search('/movies/', link)
        if name != "...more" and is_movie:
            addon.add_video_item({
                'url': link,
Exemplo n.º 3
0
    else:
        for season in seasons.group(1).split('<h2>'):
            r = re.search('<a.+?>(.+?)</a>', season)
            if r:
                season_name = r.group(1)
            else:
                season_name = 'Unknown Season'
                addon.log_error('couldn\'t find season title')

            r = '"tv_episode_item".+?href="(.+?)">(.*?)</a>'
            episodes = re.finditer(r, season, re.DOTALL)
            for ep in episodes:
                url, title = ep.groups()
                title = re.sub('<[^<]+?>', '', title.strip())
                title = re.sub('\s\s+' , ' ', title)
                addon.add_video_item(base_url + url, {'title': '%s %s' % 
                                                 (season_name, title)}, img=img)


elif mode == 'main':
    addon.add_directory({'mode': 'browse', 'section': 'tv'}, 'TV')
    addon.add_directory({'mode': 'resolver_settings'}, 'Resolver Settings', 
                        is_folder=False)

elif mode == 'resolver_settings':
    urlresolver.display_settings()


if not play:
    addon.end_of_directory()

Exemplo n.º 4
0
    html = net.http_GET(url).content

    page = int(page_num) 
    if page > 1:
        addon.add_directory({'mode': 'mainexit'}, {'title': '[COLOR red]Back to Main Menu[/COLOR]'}, img=icon_path + 'back_arrow.png')

    if page < 2:
        page = page +  1
        addon.add_directory({'mode': 'tvchannels', 'url': showlist_url_2, 'page_num': page}, {'title': '[COLOR blue]Next Page[/COLOR]'}, img=icon_path + 'next_arrow.png')

    match = re.compile('<a[ A-Za-z0-9\"=]* Title[ ]*="(.+?)"[ A-Za-z0-9\"=]* href="(.+?)"><img border="0" src="(.+?)" style=.+?</a>').findall(html)
    for name, link, thumb in match:
        if not re.search('http://', thumb):
            thumb = main_url + thumb
        if not re.search('veetle', link):
            addon.add_video_item({'mode': 'channel', 'url': shows_url + link}, {'title': name}, img=thumb)


elif mode == 'classics':
    print 'Retrieving: %s' % url
    html = net.http_GET(url).content

    page = int(page_num)    
    if page > 1:
        addon.add_directory({'mode': 'mainexit'}, {'title': '[COLOR red]Back to Main Menu[/COLOR]'}, img=icon_path + 'back_arrow.png')

    if page < 6:
        page = page +  1
        addon.add_directory({'mode': 'classics', 'url': classic_shows_url % page, 'page_num': page}, {'title': '[COLOR blue]Next Page[/COLOR]'}, img=icon_path + 'next_arrow.png')

    match = re.compile('<td width=110><a href="(.+?)"><img src="(.+?)" border="0" width=100 height=60 />(.+?)</a>').findall(html)
Exemplo n.º 5
0
    print 'Retrieving: %s' % url
    html = net.http_GET(url).content

    page = int(page_num)    
    if page > 1:
        addon.add_directory({'mode': 'mainexit'}, {'title': '[COLOR red]Back to Main Menu[/COLOR]'}, img=icon_path + 'back_arrow.png')

    if page < 4:
        page = page +  1
        addon.add_directory({'mode': 'classics', 'url': classic_shows_url % page, 'page_num': page}, {'title': '[COLOR blue]Next Page[/COLOR]'}, img=icon_path + 'next_arrow.png')

    match = re.compile('<a Title="" href="(.+?)" target="img_m"><img border="0" src="(.+?)" style="filter:alpha\(opacity=50\); -moz-opacity:0.5" onMouseover="lightup\(this, 100\)" onMouseout="lightup\(this, 30\)" width="110" height="80"></a>(.+?)</td>').findall(html)
    for link, thumb, name in match:
        if not re.search('http://', thumb):
            thumb = main_url + thumb
        addon.add_video_item({'mode': 'channel', 'url': link}, {'title': name}, img=thumb)


elif mode == 'livetv':
    print 'Retrieving: %s' % url
    html = net.http_GET(url).content

    page = int(page_num)    
    if page > 1:
        addon.add_directory({'mode': 'mainexit'}, {'title': '[COLOR red]Back to Main Menu[/COLOR]'}, img=icon_path + 'back_arrow.png')

    if page < 4:
        page = page +  1
        addon.add_directory({'mode': 'livetv', 'url': livetv_pages % page, 'page_num': page}, {'title': '[COLOR blue]Next Page[/COLOR]'}, img=icon_path + 'next_arrow.png')

    match = re.compile('<td width="100%" .+? href="(.+?)" target="img_m"><img border="0" src="(.+?)" style=.+?></a>(.+?)</td>').findall(html)
Exemplo n.º 6
0
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        listitem = xbmcgui.ListItem(title)
        playlist.add(stream_url, listitem)
        xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(playlist)
    else:
        partNo = 1
        prevSource = ''
        for sourceVideo, sourceName, _ in videoItem:
            if sourceName != prevSource:
                partNo = 1
                prevSource = sourceName

            title = sourceName + ' Part# ' + str(partNo)
            addon.add_video_item({'url': sourceVideo}, {'title': title})
            partNo += 1

        xbmcplugin.endOfDirectory(int(sys.argv[1]))


def Main_Categories():
    addon.add_directory({'mode': 'tv'}, {'title': '[B]Live TV[/B]'},
                        img=getImgPath('Live TV'))
    addon.add_directory({'mode': 'radio'}, {'title': '[B]Live Radio[/B]'},
                        img=getImgPath('Live Radio'))
    addon.add_directory({'mode': 'vod'}, {'title': '[B]On Demand[/B]'},
                        img=getImgPath('On Demand'))
    addon.add_directory({
        'mode': 'movie',
        'url': MOVIE_URL
Exemplo n.º 7
0
       addon.add_directory({'mode': 'plinkettreviews', 'url': link}, {'title': name})

elif mode == 'plinkettreviews':
    url = addon.queries['url']
    html = get_http_error(url)

    section = re.search('<h1 class="page-title">.+?</h1>(.+?)<script type="text/javascript">', html, re.DOTALL).group(1)
    match = re.compile('<a href="(.+?)"><img src="(.+?)">').findall(section)
    for link, thumb in match:
        name = re.search("[http://]*[a-z./-]*/(.+?)/",'/' + link).group(1).replace('-',' ').replace('/',' ').title()
        
        if re.search('http',link):
            newlink = link
        else:
            newlink = url + link
        addon.add_video_item({'url': newlink},{'title':name},img=thumb)

elif mode == 'halfbag':
    url = addon.queries['url']
    html = get_http_error(url)
    
    halfbag = re.search('<li id="menu-item-527"(.+?)</ul>', html, re.DOTALL)
    if halfbag:
        match = re.compile('<a href="(.+?)">(.+?)</a></li>').findall(halfbag.group(0))
        for link, name in match:
            addon.add_directory({'mode': 'halfbag-episodes', 'url': link}, {'title': name})


elif mode == 'halfbag-episodes':
    url = addon.queries['url']
    html = get_http_error(url)
Exemplo n.º 8
0
    host = addon.queries.get('host', '')
    media_id = addon.queries.get('media_id', '')
    #stream_url = urlresolver.resolve(play)
    stream_url = urlresolver.HostedMediaFile(url=url, host=host, media_id=media_id).resolve()
    addon.resolve_url(stream_url)

elif mode == 'resolver_settings':
    urlresolver.display_settings()

elif mode == 'test':
    url = "http://giaitri.com/new/index.php?cat=12"
    html = net.http_GET(url).content
    ret = common.parseDOM(html, "div", attrs = { "class": "s1'" })
    v_urls = common.parseDOM(ret, "a", attrs = { "class": "image_border" })
    print repr(v_urls)
    addon.add_video_item({'host': 'dailymotion.com','media_id':'xsla2x'},{'title': 'dailymotion test 1'})
    addon.add_video_item({'host': 'youtube.com','media_id':'_fUi2NnjPCE'},{'title': 'youtube test 1'})



elif mode == 'giaitricom_tap_play':
    tap_url = addon.queries.get('tap_url', '')  
    v_url = urllib.unquote(net.http_GET(tap_url).content)
    print v_url
    addon.add_video_item({'url': v_url[v_url.find("http://"):]},{'title': 'Play...'})
    
                
elif mode == 'giaitricom_tap_list':
    url = addon.queries.get('phim_url', '')
    html = utf8decode(net.http_GET(url).content)
    #print html.encode('ascii', 'xmlcharrefreplace')
Exemplo n.º 9
0
       addon.add_directory({'mode': 'movieslist', 'url': MainUrl + link, 'section': 'movies'}, {'title': genre})
  
elif mode == 'movieslatest':
    latestlist = []
    url = MovieUrl
    html = net.http_GET(url).content
        
    match = re.compile('''<a onclick='visited.+?' href=".+?" target=.+?<div>(.+?)</div>''',re.DOTALL).findall(html)
    for name in match:
        latestlist.append(name)

    #convert list to a set which removes duplicates, then back to a list
    latestlist = list(set(latestlist))

    for movie in latestlist:
        addon.add_video_item({'url': MovieUrl, 'section': 'latestmovies', 'video': movie}, {'title': movie})

elif mode == 'moviespopular':
    url = MainUrl
    html = net.http_GET(url).content
    match = re.compile('''<td align="center"><a href="(.+?)">(.+?)</a></td>''',re.DOTALL).findall(html)

    # Add each link found as a directory item
    for link, name in match:
       is_movie = re.search('/movies/', link)
       if name != "...more" and is_movie:
          addon.add_video_item({'url': link, 'section': 'movies'}, {'title': name}, total_items=len(match))

elif mode == 'moviesyear':
    url = MovieUrl
    html = net.http_GET(url).content
Exemplo n.º 10
0
elif mode == 'series':
    url = addon.queries['url']
    html = net.http_GET(url).content
    r = 'javascript:show_season\("(\d+?)","(.+?)"\)'
    regex = re.finditer(r, html, re.DOTALL)
    for s in regex:
        season, data = s.groups()
        episodes = data.split('||')
        for episode in episodes:
            params = episode.split('_')
            if len(params) == 5:
                ep_url = '%s/player/%s/' % (base_url, params[2])
                title = 'S%sE%s - %s (%s)' % (params[0], params[1],
                                              params[3], params[4])
                common.addon.log_debug('Episodes %s at %s' % (ep_url, title))
                addon.add_video_item({'url': ep_url}, {'title': title})
elif mode == 'movie':
    xbmc.executebuiltin("Container.SetViewMode(%s)" % 'movies' )
    
    url = addon.queries['url']
    html = net.http_GET(url).content
    
    r = "<h1>(.+?) \((\d+)\)</h1>.+<b>IMDB:</b>.+<span>tt(\d+)</span>"
    meta = re.findall(r, html, re.DOTALL)
    
    r = "<a.+?href=\"javascript:show\('(\w+?)','(.+?)', '(.+?)'.+?<b>(\d+)% said work.+?<\/b>"
    regex = re.finditer(r, html, re.DOTALL)
    for s in regex:
        id, title, host, quality = s.groups()
        addon.add_item({'host': host, 'media_id' : id},
                             {'title': u'%s (%s)' % (meta[0][0] , host),
Exemplo n.º 11
0
    cm.add_context('Go to addon main screen', { 'mode' : 'main' }, True)
    cm.add_favorite('Save solarmovie favorite', 
                                  { 'mode' : 'play' },'savefavorite', 
                                  'movie')
    page = 1
    url = addon.queries['url']
    while page <= numpages:
        if addon.queries['multipage'] == 'yes':
            url = ('%s?page=%s') % (addon.queries['url'], page)
        else:
            page = 9998
        html = net.http_GET(url).content
        match = MatchMovieEntries(html)        
        for thumbnail, title, url in match:
            url = base_url + url
            addon.add_video_item( url, { 'title' : title }, thumbnail, cm=cm)
        page = page + 1


elif mode == 'findsolartvshows':
    cm.add_context('Jump to favorites', { 'mode' : 'showfavorites' }, True)
    cm.add_context('Go to addon main screen', { 'mode' : 'main' }, True)
    cm.add_favorite('Save solarmovie favorite', 
                                  { 'mode' : 'findtvseason' },'savefavorite', 
                                  'tv')
    page = 1
    url = addon.queries['url']
    while page <= numpages:
        if addon.queries['multipage'] == 'yes':
            if page == 1:
                url = addon.queries['url']
Exemplo n.º 12
0
elif mode == 'movies':
    addon.add_directory({'mode': 'moviestop', 'url': main_url, 'section': 'movie'}, {'title': 'Top Movies'}, img='')
    addon.add_directory({'mode': 'moviesaz', 'section': 'movie'}, {'title': 'A-Z'}, img='')
    addon.add_directory({'mode': 'moviesgenre', 'url': main_url + 'videos?mt=1', 'section': 'movie'}, {'title': 'Genre'}, img='')
    addon.add_directory({'mode': 'moviesrecent', 'url': main_url + 'videos?a=dr&mt=1', 'section': 'movie'}, {'title': 'Recently Released'}, img='')
    addon.add_directory({'mode': 'moviesadded', 'url': main_url + 'videos?a=da&mt=1', 'section': 'movie'}, {'title': 'Recently Added'}, img='')
    addon.add_directory({'mode': 'moviespopular', 'url': main_url + 'videos?a=m&mt=1', 'section': 'movie'}, {'title': 'Most Popular'}, img='')
    addon.add_directory({'mode': 'moviesyear', 'url': main_url + 'videos?mt=1', 'section': 'movie'}, {'title': 'Year'}, img='')

elif mode == 'moviestop':
    html = net.http_GET(url).content
    r = re.search('<p>Top Movies</p>(.+?)</div>',html,re.DOTALL).group(1)
    if r:
        match = re.compile('<a id="big_pic[0-9]" href="(.+?)"><img src=".+?" alt=".+?" title="(.+?)"/></a>').findall(r)
        for link, title in match:
            addon.add_video_item({'url': link}, {'title': title}, img='')
            
elif mode == 'moviesaz':
   AZ_Menu('movieslist', 'videos?mt=1&l=%s')

elif mode == 'moviesgenre':
    html = net.http_GET(url).content
    
    #Grab only portion of html that has genre
    r = re.search('Choose a Genre</option>(.+?)</select>',html, re.DOTALL) 
    
    if r:
        match = re.compile('<option label=".+?" value="(.+?)">(.+?)</option>').findall(r.group(1))

    # Add each link found as a directory item
    for link, genre in match:
Exemplo n.º 13
0
            {
                'mode': 'classics',
                'url': classic_shows_url % page,
                'page_num': page
            }, {'title': '[COLOR blue]Next Page[/COLOR]'},
            img=icon_path + 'next_arrow.png')

    match = re.compile(
        '<a Title="" href="(.+?)" target="img_m"><img border="0" src="(.+?)" style="filter:alpha\(opacity=50\); -moz-opacity:0.5" onMouseover="lightup\(this, 100\)" onMouseout="lightup\(this, 30\)" width="110" height="80"></a>(.+?)</td>'
    ).findall(html)
    for link, thumb, name in match:
        if not re.search('http://', thumb):
            thumb = main_url + thumb
        addon.add_video_item({
            'mode': 'channel',
            'url': link
        }, {'title': name},
                             img=thumb)

elif mode == 'livetv':
    print 'Retrieving: %s' % url
    html = net.http_GET(url).content

    page = int(page_num)
    if page > 1:
        addon.add_directory({'mode': 'mainexit'},
                            {'title': '[COLOR red]Back to Main Menu[/COLOR]'},
                            img=icon_path + 'back_arrow.png')

    if page < 4:
        page = page + 1
Exemplo n.º 14
0
                'alt="Watch (.+?)"'
            regex = re.finditer(r, html, re.DOTALL)
            urls = []
            for s in regex:
                url, thumb, title = s.groups()
                if url not in urls:
                    urls.append(url)
                    if section == 'tv':
                        addon.add_directory({'mode': 'series', 
                                             'url': base_url + url}, 
                                             {'title': title}, 
                                             img=thumb,
                                             total_items=total)
                    else:
                        addon.add_video_item({'url': base_url + url}, 
                                             {'title': title}, 
                                              img=thumb, total_items=total)

    elif genre:
        if genre != 'All':
            addon.add_directory({'mode': 'browse', 
                                 'section': section,
                                 'genre': genre,
                                 'letter': 'All'}, {'title': 'All'})
        addon.add_directory({'mode': 'browse', 
                             'section': section,
                             'genre': genre,
                             'letter': '123'}, {'title': '#'})
        for l in string.uppercase:
            addon.add_directory({'mode': 'browse', 
                                 'section': section,
Exemplo n.º 15
0
        {
            'mode': 'moviesyear',
            'url': main_url + 'videos?mt=1',
            'section': 'movie'
        }, {'title': 'Year'},
        img='')

elif mode == 'moviestop':
    html = net.http_GET(url).content
    r = re.search('<p>Top Movies</p>(.+?)</div>', html, re.DOTALL).group(1)
    if r:
        match = re.compile(
            '<a id="big_pic[0-9]" href="(.+?)"><img src=".+?" alt=".+?" title="(.+?)"/></a>'
        ).findall(r)
        for link, title in match:
            addon.add_video_item({'url': link}, {'title': title}, img='')

elif mode == 'moviesaz':
    AZ_Menu('movieslist', 'videos?mt=1&l=%s')

elif mode == 'moviesgenre':
    html = net.http_GET(url).content

    #Grab only portion of html that has genre
    r = re.search('Choose a Genre</option>(.+?)</select>', html, re.DOTALL)

    if r:
        match = re.compile(
            '<option label=".+?" value="(.+?)">(.+?)</option>').findall(
                r.group(1))
Exemplo n.º 16
0
    if page < 4:
        page = page + 1
        addon.add_directory(
            {"mode": "classics", "url": classic_shows_url % page, "page_num": page},
            {"title": "[COLOR blue]Next Page[/COLOR]"},
            img=icon_path + "next_arrow.png",
        )

    match = re.compile(
        '<a Title="" href="(.+?)" target="img_m"><img border="0" src="(.+?)" style="filter:alpha\(opacity=50\); -moz-opacity:0.5" onMouseover="lightup\(this, 100\)" onMouseout="lightup\(this, 30\)" width="110" height="80"></a>(.+?)</td>'
    ).findall(html)
    for link, thumb, name in match:
        if not re.search("http://", thumb):
            thumb = main_url + thumb
        addon.add_video_item({"mode": "channel", "url": link}, {"title": name}, img=thumb)


elif mode == "livetv":
    print "Retrieving: %s" % url
    html = net.http_GET(url).content

    page = int(page_num)
    if page > 1:
        addon.add_directory(
            {"mode": "mainexit"}, {"title": "[COLOR red]Back to Main Menu[/COLOR]"}, img=icon_path + "back_arrow.png"
        )

    if page < 4:
        page = page + 1
        addon.add_directory(
Exemplo n.º 17
0
mode = addon.queries['mode']
play = addon.queries.get('play', None)

if play:
    url = addon.queries.get('url', '')
    host = addon.queries.get('host', '')
    media_id = addon.queries.get('media_id', '')
    #stream_url = urlresolver.resolve(play)
    stream_url = urlresolver.HostedMediaFile(url=url, host=host, media_id=media_id).resolve()
    addon.resolve_url(stream_url)

elif mode == 'resolver_settings':
    urlresolver.display_settings()

elif mode == 'test':
    addon.add_video_item({'url': 'http://www.2gb-hosting.com/v/94fb733db6e9f984b07da3cb238eb277/2074fe10f41c7e1.flv.html'},
                         {'title': '2gbhosting url'})
    addon.add_video_item({'host': '2gb-hosting.com', 'media_id': 'e1593e96e19f7ecced3778668e809c77/efc5d03968fbca6.avi.html'},
                         {'title': '2gbhosting media id'})
    addon.add_video_item({'url': 'http://www.dailymotion.com/swf/k6Vt2rxUsqz2fk1cS36'},
                         {'title': 'dailymotion url'})
    addon.add_video_item({'host': 'dailymotion.com', 'media_id': 'k6Vt2rxUsqz2fk1cS36'},
                         {'title': 'dailymotion media id'})
    addon.add_video_item({'url': 'http://www.divxstage.eu/video/eb20c352c3ccc'},
                         {'title': 'divxstage url'})
    addon.add_video_item({'host': 'divxstage.eu', 'media_id': 'eb20c352c3ccc'},
                         {'title': 'divxstage media id'})
    addon.add_video_item({'url': 'http://www.ecostream.tv/stream/b83c3c5d07b1ab195fb8245576c27daa.html?' +
                          'width=679&height=365&bGetRedirectUrl=False&sFileName=Larry+Crowne'},
                         {'title': 'ecostream url'})
    addon.add_video_item({'host': 'ecostream', 'media_id': 'b83c3c5d07b1ab195fb8245576c27daa'},
                         {'title': 'ecostream media id'})
class CraftsyPlugin():
    addon = None
    net = None
    logo = None
    profile_path = None
    cookie_file = None
    base_url = None
    free_url = 'http://www.craftsy.com.edgesuite.net/'
    pay_url = 'http://cd1.craftsy.com/'

    def __init__(self):
        self.addon = Addon('plugin.video.craftsy', sys.argv)
        self.net = Net()

        self.logo = os.path.join(self.addon.get_path(), 'art','logo.jpg')

        self.profile_path = self.addon.get_profile()
        self.cookie_file = os.path.join(self.profile_path, 'craftsy.cookies')

        try:
            os.makedirs(os.path.dirname(self.cookie_file))
        except OSError:
            pass

        self.net.set_cookies(self.cookie_file)
        self.base_url = 'http://www.craftsy.com'

    def __get_image(self, url):
        fname = os.path.join(self.profile_path, md5.new(url).digest())
        print fname
        if os.path.isfile(fname):
            return fname
        return url

    def __check_link(self, url):
        if (re.match('^/', url)):
            return 'http:' + url
        return url

    def __fetch_regexp_idx(self, r, idx, default = None):
        if (r == None):
            return default
        if (len(r.groups()) < idx + 1):
            return default

        return r.groups()[idx]

    def check_login(self):
        source = self.net.http_GET(self.base_url + '/my/home?NAVIGATION_PAGE_CONTEXT_ATTR=NONE').content
        r = re.search('<title>([^<]+)</title>', source)
        title = r.groups()[0]
        
        if title == 'Welcome Back to Craftsy!':
            return False
        return True

    def __get_url(self, url):
        return self.net.http_GET(url).content.encode('utf8').replace("\n", "").replace("\r", "")

    def add_classes(self):
        source = self.__get_url(self.base_url + '/my/home?NAVIGATION_PAGE_CONTEXT_ATTR=NONE')
        source = re.sub('<div class="classCard mostRecent".*?</div>.*?</div>.*?</div>.*?</div>', '', source)
        source = re.sub('<div class="continueArea".*?</div>.*?</div>', '', source)
        # parts = re.split('<div class="classBot myClassBot">', source)
        r = re.findall('<a href="(/lecture[^\"]+)"(.*?)</a>[ \s\t]*<div class="classBot myClassBot">.*?<a href="([^"]+)"', source)
        for i in r:
            url = i[2]
            if (re.match('^/', url)):
                url = self.base_url + url
            t = re.search('<h4>([^<]+)</h4>', i[1])
            title = 'N/A'
            title = self.__fetch_regexp_idx(t, 0, 'N/A')
            img = self.base_url + '/images/craftsy/noImageTitleCard.png'
            t = re.search('<img src="([^"]+)" alt="[^"]+" onerror', i[1])
            _u = self.__fetch_regexp_idx(t, 0)
            if (_u != None):
                img = self.__check_link(_u)

            # print self.__get_image(img)
            self.addon.add_directory({'mode': 'classes', 'url': url}, {'title': title}, fanart=img, img=img)

    def __try_resolve(self, pattern, video):
        r = re.search(pattern, video)
        return self.__fetch_regexp_idx(r, 0)

    def resolve_url(self, lesson_url):
        pattern = '&([0-9]+)&(pay|free)$'
        l = re.search(pattern, lesson_url)
        lesson_id = self.__fetch_regexp_idx(l, 0)
        lesson_type = self.__fetch_regexp_idx(l, 1, 'pay')
        lesson_url = re.sub(pattern, '', lesson_url)

        q = self.addon.get_setting('quality')
        t = self.addon.get_setting('type')

        source = self.__get_url(lesson_url)

        uid = re.search('/([0-9]+)\\.html(\\?t=[0-9]*){0,1}$', lesson_url)
        url_id = self.__fetch_regexp_idx(uid, 0)
        if (url_id == None):
            return None

        r = re.search('arbitraryId = ([0-9]+),', source)
        arbitraryId = self.__fetch_regexp_idx(r, 0)
        if (arbitraryId != None):
            url_id = arbitraryId

        suffix = lesson_id + '/' + url_id + '/' + url_id + '-' + q + '.' + t
        if lesson_type == 'free':
            print "THE URL TO PLAY IS " + self.free_url + suffix
            return self.free_url + suffix
        else:
            return self.pay_url + suffix

        # r = re.search('(<video.*?</video>)', source)

        # if (len(r.groups()) == 0):
        #     return None
        # else:
        #     video = r.groups()[0]
        #     video_url = self.__try_resolve('<source src="([^"]+-' + q + '\\.' + t + ')"', video)
        #     if (video_url == None):
        #         video_url = self.__try_resolve('<source src="([^"]+-' + q + '\\.[^\\.]+)"', video)
        #         if (video_url == None):
        #             video_url = self.__try_resolve('<source src="([^"]+)"', video)

        #     return video_url


    def add_lessons(self, class_url):
        source = self.__get_url(class_url) # self.net.http_GET(class_url).content
        l = re.search('\,([0-9]+)$', class_url)
        lesson_id = self.__fetch_regexp_idx(l, 0)
        if (lesson_id == None):
            self.addon.show_error_dialog(['Could not fetch the lesson ID']);
            return None
        r = re.findall('(<tr class="classLesson.*?</tr>)', source)
        first = True
        lesson_type = 'pay'
        for i in r:
            text = i 
            el = re.search('<td class="lessonName">.*?<a href="([^"]+)">(.*?)</a>', text)
            href = self.__fetch_regexp_idx(el, 0)
            if href != None:
                href = self.__check_link(href)
                title = self.__fetch_regexp_idx(el, 1, 'N/A')
                if (first):
                    if (title.lower() == 'welcome to your free mini-class!'):
                        lesson_type = 'free'
                im = re.search('<td class="lessonImage">.*?<img src="([^"]+)"', text)
                img = self.__check_link(self.__fetch_regexp_idx(im, 0, os.path.join(self.addon.get_path(), 'art','no-img.jpg')))

                self.addon.add_video_item({'url': href + '&' + lesson_id + '&' + lesson_type}, {'title': title}, img = img, fanart = img)
            first = False

    def do_login(self):
        try:
            if self.check_login():
                return True
            data=(('email', self.addon.get_setting('username')), ('password', self.addon.get_setting('password')), ('forwardUrl', '/'))
            source = self.net.http_POST(self.base_url + '/doLogin.json?isCraftsyAjax=true', data).content
            response = JSONDecoder().decode(source)
            self.net.save_cookies(self.cookie_file)
            self.net.set_cookies(self.cookie_file)
            return response.get("success")
        except Exception as e:
            print e
            return False
Exemplo n.º 19
0
net = Net()

base_url = 'http://tubeplus.me'

mode = addon.queries['mode']
play = addon.queries.get('play', None)

if play:
    stream_url = urlresolver.resolve(play)
    addon.resolve_url(stream_url)

elif mode == 'resolver_settings':
    urlresolver.display_settings()

elif mode == 'test':
    addon.add_video_item('http://www.megaupload.com/?d=TQPQJM5H', 
                         {'title': 'megaupload'})
    addon.add_video_item('http://www.megavideo.com/?v=LYWNYM1J', 
                         {'title': 'megavideo'})
    addon.add_video_item('http://www.movshare.net/video/rnqmuilri1b71', 
                         {'title': 'movshare'})
    addon.add_video_item('http://www.novamov.com/video/kdshwq2cj6vxv', 
                         {'title': 'novamov'})
    addon.add_video_item('http://www.putlocker.com/file/DFE7599AE064911A', 
                         {'title': 'putlocker'})
    addon.add_video_item('http://seeon.tv/view/14451', 
                         {'title': 'seeon.tv'})
    addon.add_video_item('http://www.sockshare.com/file/541433EA7B32FB39', 
                         {'title': 'sockshare'})
    addon.add_video_item('http://www.tubeplus.me/player/1962655/Entourage/season_8/episode_2/Out_With_a_Bang_/', 
                         {'title': 'tubeplus'})
    addon.add_video_item('http://videobb.com/video/8FvAG6AQpHi8', 
Exemplo n.º 20
0
    url = addon.queries.get('url', '')
    host = addon.queries.get('host', '')
    media_id = addon.queries.get('media_id', '')
    #stream_url = urlresolver.resolve(play)
    stream_url = urlresolver.HostedMediaFile(url=url,
                                             host=host,
                                             media_id=media_id).resolve()
    addon.resolve_url(stream_url)

elif mode == 'resolver_settings':
    urlresolver.display_settings()

elif mode == 'test':
    addon.add_video_item(
        {
            'url':
            'http://www.2gb-hosting.com/v/94fb733db6e9f984b07da3cb238eb277/2074fe10f41c7e1.flv.html'
        }, {'title': '2gbhosting url'})
    addon.add_video_item(
        {
            'host': '2gb-hosting.com',
            'media_id':
            'e1593e96e19f7ecced3778668e809c77/efc5d03968fbca6.avi.html'
        }, {'title': '2gbhosting media id'})
    addon.add_video_item(
        {'url': 'http://www.divxstage.eu/video/eb20c352c3ccc'},
        {'title': 'divxstage url'})
    addon.add_video_item({
        'host': 'divxstage.eu',
        'media_id': 'eb20c352c3ccc'
    }, {'title': 'divxstage media id'})
Exemplo n.º 21
0
    for link, name in match:
       addon.add_directory({'mode': 'plinkettreviews', 'url': link}, {'title': name})

elif mode == 'plinkettreviews':
    url = addon.queries['url']
    html = get_http_error(url)

    match = re.compile('<td.+?<a href="(.+?)".+?img src="(.+?)"').findall(html)
    for link, thumb in match:
        name = re.search("[http://]*[a-z./-]*/(.+?)/",'/' + link).group(1).replace('-',' ').replace('/',' ').title()
        
        if re.search('http',link):
            newlink = link
        else:
            newlink = url + link
        addon.add_video_item({'url': newlink},{'title':name},img=thumb)

elif mode == 'halfbag':
    url = addon.queries['url']
    html = get_http_error(url)

    match = re.compile('<td width=270><a href="(.+?)" ><img src="(.+?)"></a></td>').findall(html)
    
    episodenum = 1
    for link, thumb in match:
        addon.add_video_item({'url': link},{'title':'Episode ' + str(episodenum)},img=thumb)
        episodenum += 1
    
elif mode == 'featurefilms':
    url = addon.queries['url']
    html = get_http_error(url)
Exemplo n.º 22
0
            urls = []
            for s in regex:
                url, thumb, title = s.groups()
                if url not in urls:
                    urls.append(url)
                    if section == 'tv':
                        addon.add_directory(
                            {
                                'mode': 'series',
                                'url': base_url + url
                            }, {'title': title},
                            img=thumb,
                            total_items=total)
                    else:
                        addon.add_video_item({'url': base_url + url},
                                             {'title': title},
                                             img=thumb,
                                             total_items=total)

    elif genre:
        if genre != 'All':
            addon.add_directory(
                {
                    'mode': 'browse',
                    'section': section,
                    'genre': genre,
                    'letter': 'All'
                }, {'title': 'All'})
        addon.add_directory(
            {
                'mode': 'browse',
                'section': section,
Exemplo n.º 23
0
logo = os.path.join(xbmc.translatePath(addon.get_path()), 'art','logo.jpg')

base_url = 'http://tubeplus.me'

mode = addon.queries['mode']
play = addon.queries.get('play', None)

if play:
    stream_url = urlresolver.resolve(play)
    addon.resolve_url(stream_url)

elif mode == 'resolver_settings':
    urlresolver.display_settings()

elif mode == 'test':
    addon.add_video_item('http://www.megaupload.com/?d=TQPQJM5H', 
                         {'title': 'megaupload'})
    addon.add_video_item('http://www.megavideo.com/?v=LYWNYM1J', 
                         {'title': 'megavideo'})
    addon.add_video_item('http://www.movshare.net/video/rnqmuilri1b71', 
                         {'title': 'movshare'})
    addon.add_video_item('http://www.novamov.com/video/kdshwq2cj6vxv', 
                         {'title': 'novamov'})
    addon.add_video_item('http://www.putlocker.com/file/DFE7599AE064911A', 
                         {'title': 'putlocker'})
    addon.add_video_item('http://seeon.tv/view/14451', 
                         {'title': 'seeon.tv'})
    addon.add_video_item('http://www.sockshare.com/embed/541433EA7B32FB39', 
                         {'title': 'sockshare'})
    addon.add_video_item('http://www.tubeplus.me/player/1962655/Entourage/season_8/episode_2/Out_With_a_Bang_/', 
                         {'title': 'tubeplus'})
    addon.add_video_item('http://videobb.com/video/8FvAG6AQpHi8', 
Exemplo n.º 24
0
      playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
      playlist.clear()
      listitem = xbmcgui.ListItem(title)
      playlist.add(stream_url, listitem)
      xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(playlist)
   else:
      partNo = 1
      prevSource = ''
      for sourceVideo, sourceName, _ in videoItem:
         if sourceName != prevSource:
            partNo = 1
            prevSource = sourceName

         title = sourceName + ' Part# ' + str( partNo )
         addon.add_video_item( { 'url' : sourceVideo }, { 'title' : title } )
         partNo += 1

      xbmcplugin.endOfDirectory(int(sys.argv[1]))

def Main_Categories():
   addon.add_directory( { 'mode' : 'tv' }, { 'title' : '[B]Live TV[/B]' }, 
                        img=getImgPath('Live TV') )
   addon.add_directory( { 'mode' : 'radio' }, { 'title' : '[B]Live Radio[/B]' }, 
                        img=getImgPath('Live Radio') )
   addon.add_directory( { 'mode' : 'vod' }, { 'title' : '[B]On Demand[/B]' }, 
                        img=getImgPath('On Demand') )
   addon.add_directory( { 'mode' : 'movie', 'url' : MOVIE_URL }, { 'title' : '[B]Movies[/B]' }, 
                        img=getImgPath('Movies') )
   xbmcplugin.endOfDirectory(int(sys.argv[1]))
Exemplo n.º 25
0
        playlist.clear()
        listitem = xbmcgui.ListItem(title, thumbnailImage=iconImg)
        playlist.add(stream_url, listitem)
        xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(playlist)
    else:
        partNo = 1
        prevSource = ''
        for sourceVideo, sourceName, hostname in videoItem:
            if sourceName != prevSource:
                partNo = 1
                prevSource = sourceName

            title = sourceName + ' Part# ' + str(partNo)
            print 'icon=====>', iconImg
            addon.add_video_item({'url': sourceVideo}, {'title': title},
                                 img=iconImg,
                                 fanart=iconImg)
            partNo += 1

        xbmcplugin.endOfDirectory(int(sys.argv[1]))


def parse_cloud_url(url):
    if 'toolstube' in url:
        api_html = net.http_GET(url).content
        rapi = re.search('var files = \'{".*":"(.+?)"}', api_html)
        print 'this is ------------------ toolstube',
        return urllib.unquote(rapi.group(1)).replace(
            '\\/', '/') + '|Referer=http://toolstube.com/'

    if 'playhd.video' in url:
Exemplo n.º 26
0
    html = get_http_error(url)

    section = re.search(
        '<h1 class="page-title">.+?</h1>(.+?)<script type="text/javascript">',
        html, re.DOTALL).group(1)
    match = re.compile('<a href="(.+?)"><img src="(.+?)">').findall(section)
    for link, thumb in match:
        name = re.search("[http://]*[a-z./-]*/(.+?)/",
                         '/' + link).group(1).replace('-', ' ').replace(
                             '/', ' ').title()

        if re.search('http', link):
            newlink = link
        else:
            newlink = url + link
        addon.add_video_item({'url': newlink}, {'title': name}, img=thumb)

elif mode == 'halfbag':
    url = addon.queries['url']
    html = get_http_error(url)

    halfbag = re.search('<li id="menu-item-527"(.+?)</ul>', html, re.DOTALL)
    if halfbag:
        match = re.compile('<a href="(.+?)">(.+?)</a></li>').findall(
            halfbag.group(0))
        for link, name in match:
            addon.add_directory({
                'mode': 'halfbag-episodes',
                'url': link
            }, {'title': name})