Exemplo n.º 1
0
class NovamovResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "novamov"


    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()


    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        #find key
        r=None
        try:
            html = self.net.http_GET(web_url).content
            if 'nowvideo' in host:
                r = re.search('fkzd="(.+?)";\n\t\t\tflashvars.domain=".+?";\n\t\t\tflashvars.file="(.+?)";',html, re.DOTALL)
            elif 'novamov' in host:
                r = re.search('flashvars.file="(.+?)";\n\t\t\tflashvars.filekey="(.+?)";',html, re.DOTALL)

            print 'find key: '+str(r)
            if r:
                filekey, filename = r.groups()
                print "FILEBLOBS=%s  %s"%(filename,filekey)
            else:
                r = re.search('file no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')

            #get stream url from api
            if 'movshare' in host:
                api = 'http://www.movshare.net/api/player.api.php?key=%s&file=%s' % (filekey, filename)
            elif 'nowvideo' in host:
                api = 'http://www.nowvideo.eu/api/player.api.php?key=%s&file=%s' % (filekey, filename)
            elif 'novamov' in host:
                api = 'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filename, filekey)
            print api
            html = self.net.http_GET(api).content
        
            r = re.search('url=(.+?)&title', html)
            if r:
                stream_url = r.group(1)
                stream_url = re.sub('%3A',':',stream_url)
                stream_url = re.sub('%2F','/',stream_url)
            else:
                r = re.search('file no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')
            
            return stream_url
        except urllib2.URLError, e:
            common.addon.log_error('Novamov: got http error %d fetching %s' %
                                    (e.code, web_url))
            return False
        except Exception, e:
            common.addon.log_error('**** Novamov Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]NOVAMOV[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return False
class MightyuploadResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mightyupload"
    domains = ["mightyupload.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        form_values = {}
        stream_url = None
        for i in re.finditer('<input type="hidden" name="(.*?)" value="(.*?)"', html):
            form_values[i.group(1)] = i.group(2)
        html = self.net.http_POST(web_url, form_data=form_values).content
        r = re.search('<IFRAME SRC="(.*?)" .*?></IFRAME>', html, re.DOTALL)
        if r:
            html = self.net.http_GET(r.group(1)).content
        r = re.search("<div id=\"player_code\">.*?<script type='text/javascript'>(.*?)</script>", html, re.DOTALL)
        if not r:
            raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Player config not found.')
        r_temp = re.search("file: '([^']+)'", r.group(1))
        if r_temp:
            stream_url = r_temp.group(1)
        else:
            js = jsunpack.unpack(r.group(1))
            r = re.search("'file','([^']+)'", js.replace('\\', ''))
            if not r:
                r = re.search('"src"value="([^"]+)', js.replace('\\', ''))

            if not r:
                raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Filelink not found.')

            stream_url = r.group(1)

        if stream_url:
            return stream_url + '|User-Agent=%s' % (common.IE_USER_AGENT)
        else:
            raise UrlResolver.ResolverError('Unable to resolve link')

    def get_url(self, host, media_id):
            return 'http://www.mightyupload.com/embed-%s.html' % (media_id)

    def get_host_and_id(self, url):
        r = re.search('http://(?:www.)?(.+?)/embed-([\w]+)-', url)
        if r:
            return r.groups()
        else:
            r = re.search('//(.+?)/([\w]+)', url)
            if r:
                return r.groups()
            else:
                return False


    def valid_url(self, url, host):
        return re.match('http://(www.)?mightyupload.com/[0-9A-Za-z]+', url) or 'mightyupload' in host
Exemplo n.º 3
0
class VeohResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "veoh"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        print 'veoh resolver: in get_media_url'
        print 'host %s media_id %s' %(host, media_id)

        html = self.net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse").content
        if not re.search('This video is not available on mobile', html):
            r = re.compile("watchNow\('(.+?)'").findall(html)
            if (len(r) > 0 ):
                return r[0]

        url = 'http://www.veoh.com/rest/video/'+media_id+'/details'
        print 'url is %s' %url
        html = self.net.http_GET(url).content
        file = re.compile('fullPreviewHashPath="(.+?)"').findall(html)

        if len(file) == 0:
            print 'coult not obtain video url'
            return False

        print 'video link is %s' % file[0]
        return file[0]

    def get_url(self, host, media_id):
        return 'http://veoh.com/watch/%s' % media_id


    def get_host_and_id(self, url):
        r = None
        video_id = None
        print 'veoh resolver: in get_host_and_id %s ' % url
        if re.search('permalinkId=', url):
            r = re.compile('veoh.com.+?permalinkId=(\w+)&*.*$').findall(url)
        elif re.search('watch/', url):
            r = re.compile('watch/(.+)').findall(url)
            
        if r is not None and len(r) > 0:
            video_id = r[0]
        if video_id:
            return ('veoh.com', video_id)
        else:
            common.addon.log_error('veoh: video id not found')
            return False

    def valid_url(self, url, host):
        return re.search('www.veoh.com/watch/.+',url) or re.search('www.veoh.com/.+?permalinkId=.+',url) or 'veoh' in host

    def get_settings_xml(self):
        xml = PluginSettings.get_settings_xml(self)
        xml += '<setting label="This plugin calls the veoh addon - '
        xml += 'change settings there." type="lsep" />\n'
        return xml
class AllmyvideosResolver(Plugin,UrlResolver,PluginSettings):
    implements=[UrlResolver,PluginSettings]
    name="allmyvideos"
    def __init__(self):
        p=self.get_setting('priority') or 100
        self.priority=int(p)
        self.net=Net()

    def get_media_url(self,host,media_id):
        try:
            url=self.get_url1st(host,media_id)
            headers={'User-Agent':USER_AGENT,'Referer':url}
            html=self.net.http_GET(url,headers=headers).content
            stream_url = self.__get_best_source(html) 
            if stream_url:
                xbmc.sleep(2000)
                return stream_url
            
            url=self.get_url(host,media_id)
            headers={'User-Agent':USER_AGENT,'Referer':url}
            html=self.net.http_GET(url,headers=headers).content
            
            data={}; r=re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">',html)
            for name,value in r: data[name]=value
            html=net.http_POST(url,data,headers=headers).content
            
            stream_url = self.__get_best_source(html) 
            if stream_url:
                xbmc.sleep(2000)
                return stream_url
            
            raise Exception('could not find video')          
        except Exception, e:
            common.addon.log('**** Allmyvideos Error occured: %s' % e)
            return self.unresolvable(code=0, msg='Exception: %s' % e)
class VidxdenResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "vidxden"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        """ Human Verification """

        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
            try: os.remove(img)
            except: pass
            try:
                filename=re.compile('<input name="fname" type="hidden" value="(.+?)">').findall(html)[0]
                noscript=re.compile('<iframe src="(.+?)"').findall(html)[0]
                check = self.net.http_GET(noscript).content
                hugekey=re.compile('id="adcopy_challenge" value="(.+?)">').findall(check)[0]
                headers= {'User-Agent':'Mozilla/6.0 (Macintosh; I; Intel Mac OS X 11_7_9; de-LI; rv:1.9b4) Gecko/2012010317 Firefox/10.0a4',
                         'Host':'api.solvemedia.com','Referer':resp.get_url(),'Accept':'image/png,image/*;q=0.8,*/*;q=0.5'}
                open(img, 'wb').write( self.net.http_GET("http://api.solvemedia.com%s"%re.compile('<img src="(.+?)"').findall(check)[0]).content)
                solver = InputWindow(captcha=img)
                puzzle = solver.get()
                if puzzle:
                    data={'adcopy_response':urllib.quote_plus(puzzle),'adcopy_challenge':hugekey,'op':'download1','method_free':'1','usr_login':'','id':media_id,'fname':filename}
                    html = self.net.http_POST(resp.get_url(),data).content
            except Exception, e:
                print e
                xbmc.executebuiltin('XBMC.Notification([B][COLOR white]VIDXDEN[/COLOR][/B],[COLOR red]No such file or the file has been removed due to copyright infringement issues[/COLOR],2500,'+logo+')')
                pass
        except urllib2.URLError, e:
            common.addon.log_error('vidxden: got http error %d fetching %s' %
                                  (e.code, web_url))
            return False
       
        #find packed javascript embed code
        r = re.search('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split',html)
        if r:
            p, k = r.groups()
        else:
            common.addon.log_error('vidxden: packed javascript embed code not found')
        try: decrypted_data = unpack_js(p, k)
        except: pass
        
        #First checks for a flv url, then the if statement is for the avi url
        r = re.search('file.\',.\'(.+?).\'', decrypted_data)
        if not r:
            r = re.search('src="(.+?)"', decrypted_data)
        if r:
            stream_url = r.group(1)
        else:
            common.addon.log_error('vidxden: stream url not found')
            return False

        return "%s|User-Agent=%s"%(stream_url,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0')
Exemplo n.º 6
0
class VeohResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "veoh"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        html = self.net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse").content
        try:
            if not re.search('This video is not available on mobile', html):
                r = re.compile("watchNow\('(.+?)'").findall(html)
                if (len(r) > 0 ):
                    return r[0]

            url = 'http://www.veoh.com/rest/video/'+media_id+'/details'
            html = self.net.http_GET(url).content
            file = re.compile('fullPreviewHashPath="(.+?)"').findall(html)

            if len(file) == 0:
                raise Exception ('File Not Found or removed')

            return file[0]
        except urllib2.URLError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo)
            return False
        except Exception, e:
            common.addon.log('**** Veoh Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]VEOH[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return False
Exemplo n.º 7
0
class FlashxResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "flashx"
    domains = ["flashx.tv"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:www.|play.)?flashx.tv)/(?:embed-)?([0-9a-zA-Z/-]+)(?:.html)?'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url}
        smil = ''
        try:
            html = self.net.http_GET(web_url, headers=headers).content
            swfurl = 'http://static.flashx.tv/player6/jwplayer.flash.swf'
            r = re.search('"(http://.+?\.smil)"', html)
            if r: smil = r.group(1)
            else:
                r = re.search('\|smil\|(.+?)\|sources\|', html)
                if r: smil = 'http://flashx.tv/' + r.group(1) + '.smil'
            if smil:
                html = self.net.http_GET(smil, headers=headers).content
                r = re.search('<meta base="(rtmp://.*?flashx\.tv:[0-9]+/)(.+/)".*/>', html, re.DOTALL)
                if r:
                    rtmp = r.group(1)
                    app = r.group(2)
                    sources = re.compile('<video src="(.+?)" height="(.+?)" system-bitrate="(.+?)" width="(.+?)".*/>').findall(html)
                    vid_list = []
                    url_list = []
                    best = 0
                    quality = 0
                    if sources:
                        if len(sources) > 1:
                            for index, video in enumerate(sources):
                                if int(video[1]) > quality: best = index
                                quality = int(video[1])
                                vid_list.extend(['FlashX - %sp' % quality])
                                url_list.extend([video[0]])
                    if len(sources) == 1: vid_sel = sources[0][0]
                    else:
                        if self.get_setting('auto_pick') == 'true': vid_sel = url_list[best]
                        else:
                            result = xbmcgui.Dialog().select('Choose a link', vid_list)
                            if result != -1: vid_sel = url_list[result]
                            else: return self.unresolvable(code=0, msg='No link selected')

                    if vid_sel: return '%s app=%s playpath=%s swfUrl=%s pageUrl=%s swfVfy=true' % (rtmp, app, vid_sel, swfurl, web_url)

            raise Exception('File not found')

        except urllib2.URLError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.reason, web_url))
            return self.unresolvable(code=3, msg=e)
        
        except Exception, e:
            common.addon.log_error(self.name + ': general error occured: %s' % e)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 8
0
class NosvideoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "nosvideo"
    domains = ["nosvideo.com", "noslocker.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        url = self.get_url(host, media_id)
        html = self.net.http_GET(url).content
        if 'File Not Found' in html:
            raise UrlResolver.ResolverError('File Not Found')

        headers = {
            'Referer': url
        }

        data = {}
        r = re.findall(r'type="hidden" name="(.+?)"\s* value="(.+?)"', html)
        for name, value in r:
            data[name] = value
        data.update({'method_free': 'Free Download'})

        html = self.net.http_POST(url, data, headers=headers).content

        r = re.search('(eval\(function\(p,a,c,k,e,[dr].*)', html)
        if r:
            js = jsunpack.unpack(r.group(1))
            r = re.search('playlist=([^&]+)', js)
            if r:
                html = self.net.http_GET(r.group(1)).content
                r = re.search('<file>\s*(.*)\s*</file>', html)
                if r:
                    return r.group(1)
                else:
                    raise UrlResolver.ResolverError('Unable to locate video file')
            else:
                raise UrlResolver.ResolverError('Unable to locate playlist')
        else:
            raise UrlResolver.ResolverError('Unable to locate packed data')

    def get_url(self, host, media_id):
        return 'http://nosvideo.com/?v=%s' % media_id

    def get_host_and_id(self, url):
        r = re.search('//(.+?)/(?:\?v\=|embed/)?([0-9a-zA-Z]+)', url)
        if r:
            return r.groups()
        else:
            return False
        return('host', 'media_id')

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return (re.match('http://(www.)?(nosvideo|noslocker).com/' +
                         '(?:\?v\=|embed/)[0-9A-Za-z]+', url) or
                         'nosvideo' in host)
Exemplo n.º 9
0
def TVShowSeasonList(url, title, year, update=''): #4000
	print 'Seasons for TV Show %s' % url
	net = Net()
	cookiejar = ADDON.get_profile()
	cookiejar = os.path.join(cookiejar,'cookies')
	html = net.http_GET(url).content
	net.save_cookies(cookiejar)
	adultregex = '<div class="offensive_material">.+<a href="(.+)">I understand'
	r = re.search(adultregex, html, re.DOTALL)
	if r:
		print 'Adult content url detected'
		adulturl = BASE_URL + r.group(1)
		headers = {'Referer': url}
		net.set_cookies(cookiejar)
		html = net.http_GET(adulturl, headers=headers).content #.encode('utf-8', 'ignore')

	cnxn = sqlite.connect( DB )
	cnxn.text_factory = str
	cursor = cnxn.cursor()
	if year: title = title +'('+year+')'
	try:
		imdbnum = re.search('mlink_imdb">.+?href="http://www.imdb.com/title/(tt[0-9]{7})"', html).group(1)
	except: imdbnum = ''
	seasons = re.search('tv_container(.+?)<div class="clearer', html, re.DOTALL)
	if not seasons: ADDON.log_error('couldn\'t find seasons')
	else:
		season_container = seasons.group(1)
		season_nums = re.compile('<a href=".+?">Season ([0-9]{1,2})').findall(season_container)
		if imdbnum and META_ON == 'true': 
			metaget.update_meta('tvshow', title, imdbnum, year=year)
			season_meta = metaget.get_seasons(title, imdbnum, season_nums)
			if update:
				metaget.update_meta('tvshow', title, imdb_id='',
									new_imdb_id=imdbnum, year=year)
		seasonList = season_container.split('<h2>')
		num = 0
		temp = {}
		for eplist in seasonList:
			r = re.search('<a.+?>(.+?)</a>', eplist)
			if r:
				season_name = r.group(1)
				try: 	temp = season_meta[num]
				except: temp['cover_url'] = ''
				listitem = xbmcgui.ListItem(season_name, iconImage=temp['cover_url'], thumbnailImage=temp['cover_url'])
				listitem.setInfo(type="Video", infoLabels=temp)
				try: listitem.setProperty('fanart_image', temp['backdrop_url'])
				except: pass
				season_name = unicode_urlencode(season_name).lower()
				cursor.execute('INSERT or REPLACE into seasons (season,contents) VALUES(?,?);',
								(season_name, eplist))
				url = sys.argv[0]+ '?mode=5000'+'&season=' +season_name+ '&imdbnum='+imdbnum
				xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, 
											isFolder=True)
				cnxn.commit()
				num += 1
		setView('seasons', 'seasons-view')
		xbmcplugin.endOfDirectory(int(sys.argv[1]))
		cnxn.close()
Exemplo n.º 10
0
class MailRuResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mail.ru"
    domains = ["mail.ru"]
    pattern = '//((?:videoapi.)?my\.mail\.ru)/+(?:videos/+embed/+)?([^/]+)/+([^/]+)/+(?:video/+)?(?:[^/]+)/+([a-zA-Z1-9]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        web_url = re.findall("<a href=\"(.+?)\"", self.net.http_GET(web_url).content)[0]
        headers={'Referer':web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        match = re.search('"metaUrl"\s*:\s*"([^"]+)', html)
        videos = []
        if match:
            json_url = match.group(1)
            response = self.net.http_GET(json_url)
            html = response.content
            if html:
                js_data = json.loads(html)
                headers = dict(response._response.info().items())
                stream_url = ''
                best_quality = 0
                for video in js_data['videos']:
                    video_headers={}
                    if 'set-cookie' in headers:
                        cookie_key=re.findall("(video_key=[^;]+);", headers['set-cookie'])[0]
                        video_headers['Cookie'] = cookie_key
                    quality = video['key']
                    video_url = "%s|%s" % (video['url'], urllib.urlencode(video_headers))
                    videos.append((quality, video_url))

        if not len(videos):
            raise UrlResolver.ResolverError('No playable video found.')

        return sorted(videos, key=lambda x: x[0])[0][1]

    def get_url(self, host, media_id):
        mtype, user, media_id = media_id.split('|')
        return 'http://videoapi.my.mail.ru/videos/embed/%s/%s/st/%s.html' % (mtype, user, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            host, mtype, user, media_id = r.groups()
            return host, '%s|%s|%s' % (mtype, user, media_id)
        else:
            return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.search(self.pattern, url) or 'mail.ru' in host
class NosvideoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "nosvideo"
    domains = ["nosvideo.com", "noslocker.com"]
    pattern = '(?://|\.)(nosvideo.com|noslocker.com)/(?:\?v\=|embed/|.+?\u=)?([0-9a-zA-Z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content

        if 'File Not Found' in html:
            raise UrlResolver.ResolverError('File Not Found')

        r = re.search('class\s*=\s*[\'|\"]btn.+?[\'|\"]\s+href\s*=\s*[\'|\"](.+?)[\'|\"]', html)
        if not r:
            raise UrlResolver.ResolverError('File Not Found')

        headers = { 'Referer': r.group(1) }

        web_url = 'http://nosvideo.com/vj/video.php?u=%s&w=&h=530' % media_id

        html = self.net.http_GET(web_url, headers=headers).content

        stream_url = re.compile('var\stracker\s*=\s*[\'|\"](.+?)[\'|\"]').findall(html)
        stream_url += re.compile("tracker *: *[\'|\"](.+?)[\'|\"]").findall(html)

        if len(stream_url) > 0:
            stream_url = stream_url[0]
        else:
            raise UrlResolver.ResolverError('Unable to locate video file')

        try: stream_url = base64.b64decode(stream_url)
        except: pass

        stream_url += '|' + urllib.urlencode({ 'User-Agent': common.IE_USER_AGENT })

        return stream_url
 
    def get_url(self, host, media_id):
        return 'http://nosvideo.com/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False
    
    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
def Search(section, query, imdb):
    html = GetURL(BASE_URL)
    r = re.search('input type="hidden" name="key" value="([0-9a-f]*)"', html).group(1)
    search_url = BASE_URL + '/index.php?search_keywords='
    search_url += urllib.quote_plus(query)
    search_url += '&key=' + r
    if section == 'tv':
        search_url += '&search_section=2'
        video_type = 'tvshow'
    else:
        video_type = 'movie'

    html = GetURL(search_url)

    r = 'class="index_item.+?href="(.+?)" title="Watch (.+?)"?\(?([0-9]{4})?\)?"?>.+?src="(.+?)"'
    regex = re.search(r, html, re.DOTALL)
    if regex:
        url,title,year,thumb = regex.groups()
        net = Net()
        cookiejar = addon.get_profile()
        cookiejar = os.path.join(cookiejar,'cookies')
        net.set_cookies(cookiejar)
        html = net.http_GET(BASE_URL + url).content
        net.save_cookies(cookiejar)
        adultregex = '<div class="offensive_material">.+<a href="(.+)">I understand'
        r = re.search(adultregex, html, re.DOTALL)
        if r:
            addon.log('Adult content url detected')
            adulturl = BASE_URL + r.group(1)
            headers = {'Referer': url}
            net.set_cookies(cookiejar)
            html = net.http_GET(adulturl, headers=headers).content
            net.save_cookies(cookiejar)

        for version in re.finditer('<table[^\n]+?class="movie_version(?: movie_version_alt)?">(.*?)</table>',
                                    html, re.DOTALL|re.IGNORECASE):
            for s in re.finditer('quality_(?!sponsored|unknown)(.*?)></span>.*?'+
                                  'url=(.*?)&(?:amp;)?domain=(.*?)&(?:amp;)?(.*?)'+
                                 '"version_veiws"> ([\d]+) views</',
                                 version.group(1), re.DOTALL):
                q, url, host, parts, views = s.groups()
                q = q.upper()
                url = url.decode('base-64')
                host = host.decode('base-64')
                disp_title = '[%s] %s (%s views)' %(q, host, views)
                result = {'tag':tag, 'provider_name':display_name}
                qs = {'url':url, 'title':title, 'img':thumb, 'year':year, 'imdbnum':imdb}
                qs['video_type'] = video_type
                qs['strm'] = True
                qs['mode'] = 'PlaySource'
                result['li_url'] = 'plugin://plugin.video.1channel/?%s' %urllib.urlencode(qs)
                print result['li_url']
                result['info_labels'] = {'title':disp_title}
                yield result
Exemplo n.º 13
0
def GetContent(url):
    try:
       net = Net()
       try:
            second_response = net.http_GET(url)
       except:
            second_response = net.http_GET(url.encode("utf-8"))
       return second_response.content
    except:
       d = xbmcgui.Dialog()
       d.ok(url,"Can't Connect to site",'Try again in a moment')
Exemplo n.º 14
0
class AaaaSextvXResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "si_sextvx"
    domains = ["sextvx.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.pattern = 'http://.*?(sextvx\.com/[a-zA-Z]{2})/(?:embed|video|stream)/([0-9]+?)(?:-|$|/.*)'
        self.net = Net()
        self.user_agent = common.IE_USER_AGENT
        self.net.set_user_agent(self.user_agent)
        self.headers = {'User-Agent': self.user_agent}

    def get_url(self, host, media_id):
        return 'http://%s/embed/%s' % (host, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url) or self.name in host

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url}
        html = self.net.http_GET(web_url, headers=self.headers).content
        # http://www.sextvx.com/flux?d=web.flv&s=3&p=4,7,5,8,9,475894
        r = re.search('.*?<div id="player" path="(.+?),.+?\.(.+?)".*?', html)
        if r:
            s = r.group(1)
            p = r.group(2).replace('/', ',')
            web_url = 'http://www.sextvx.com/flux?d=web.flv&s=' + s + '&p=' + p
            stream_url = self.net.http_GET(web_url, headers=headers).content
            if stream_url:
                return self.__add_headers_for_kodi(stream_url)
        raise UrlResolver.ResolverError('File not found')

    def __add_headers_for_kodi(self, url):
        _referer = urllib.quote_plus('http://%s/' % self.domains[0])
        _user_agent = urllib.quote_plus(self.net._user_agent)
        _connection_timeout = '60'
        _cookies = ''
        for _cookie in self.net._cj:
            _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value))
        if _cookies:
            return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \
                   (url, _referer, _user_agent, _connection_timeout, _cookies)
        else:
            return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \
                   (url, _referer, _user_agent, _connection_timeout)
class ZeroCastResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "zerocast"
    domains = ["zerocast.tv"]
    pattern = '(?://|\.)(zerocast\.tv)/((?:embed|(?:channels/)*chan(?:nel)*)\.php\?.*(?:a=[0-9]+|chan=[a-zA-Z0-9]+).*)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.user_agent = common.IE_USER_AGENT
        self.net.set_user_agent(self.user_agent)
        self.headers = {'User-Agent': self.user_agent}

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        stream_url = None
        if 'chan=' in web_url:
            html = self.net.http_GET(web_url, headers=self.headers).content
            r = re.search('<script\stype=[\'"]text/javascript[\'"]\ssrc=[\'"](.+?)[\'"]>', html)
            if r:
                web_url = r.group(1)
        r = re.search('.+?a=([0-9]+).+', web_url)
        if r:
            web_url = 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % r.group(1)
            html = self.net.http_GET(web_url, headers=self.headers).content
            r = re.search('file\s*:\s*["\'](.+?)["\']', html)
            if r:
                stream_url = r.group(1)
            else:
                r = re.search('curl\s*=\s*[\'"](.+?)[\'"]', html)
                if r:
                    try:
                        stream_url = r.group(1).decode('base64', 'strict')
                    except Exception:
                        raise UrlResolver.ResolverError('Failed to decode url')
        if stream_url:
            return stream_url
        else:
            raise UrlResolver.ResolverError('File not found')

    def get_url(self, host, media_id):
        return 'http://zerocast.tv/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
class RapidVideo():
	def __init__(self, url):
		self.url = url
		self.net = Net()
		self.headers = {"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"}
		self.legenda = ''

	def getId(self):
		return urlparse.urlparse(self.url).path.split("/")[-1]

	def getMediaUrl(self):
		try:
			sourceCode = self.net.http_GET(self.url, headers=self.headers).content.decode('unicode_escape')
		except:
			sourceCode = self.net.http_GET(self.url, headers=self.headers).content

		sPattern =  '"file":"([^"]+)","label":"([0-9]+)p.+?"'
		aResult = self.parse(sourceCode, sPattern)
		try:
			self.legenda = "https://www.raptu.com%s"%re.compile('"file":"([^"]+)","label":".+?","kind":"captions"').findall(sourceCode)[0]
			#log(self.legenda)
		except:
			self.legenda = ''
		videoUrl = ''
		if aResult[0]:
			links = []
			qualidades = []
			for aEntry in aResult[1]:
				links.append(aEntry[0])
				if aEntry[1] == '2160':
					qualidades.append('4K')
				else:
					qualidades.append(aEntry[1]+'p')

			if len(links) == 1:
				videoUrl = links[0]
			elif len(links) > 1:
				links.reverse()
				qualidades.reverse()

				qualidade = xbmcgui.Dialog().select('Escolha a qualidade', qualidades)
				videoUrl = links[qualidade]

		return videoUrl
	def getLegenda(self):
		return self.legenda
	def parse(self, sHtmlContent, sPattern, iMinFoundValue = 1):
		sHtmlContent = self.replaceSpecialCharacters(str(sHtmlContent))
		aMatches = re.compile(sPattern, re.IGNORECASE).findall(sHtmlContent)
		if (len(aMatches) >= iMinFoundValue):
			return True, aMatches
		return False, aMatches
	def replaceSpecialCharacters(self, sString):
		return sString.replace('\\/','/').replace('&amp;','&').replace('\xc9','E').replace('&#8211;', '-').replace('&#038;', '&').replace('&rsquo;','\'').replace('\r','').replace('\n','').replace('\t','').replace('&#039;',"'")
Exemplo n.º 17
0
class NowvideoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "nowvideo"
    domains = [ "nowvideo.eu","nowvideo.ch","nowvideo.sx" ]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        try:
            html = self.net.http_GET(web_url).content
            key = re.compile('flashvars.filekey=(.+?);').findall(html)
            ip_key = key[0]
            pattern = 'var %s="(.+?)".+?flashvars.file="(.+?)"'% str(ip_key)
            r = re.search(pattern,html, re.DOTALL)
            if r:
                filekey, filename= r.groups()
            else:
                r = re.search('file no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')
            
            #get stream url from api
            api = 'http://www.nowvideo.sx/api/player.api.php?key=%s&file=%s' % (filekey, filename)
            html = self.net.http_GET(api).content
            r = re.search('url=(.+?)&title', html)
            if r:
                stream_url = urllib.unquote(r.group(1))
            else:
                r = re.search('no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')
                raise Exception ('Failed to parse url')
            
            try:
                # test the url, should throw 404
                nv_header = self.net.http_HEAD(stream_url)
            except urllib2.HTTPError, e:
                # if error 404, redirect it back (two pass authentification)
                api = 'http://www.nowvideo.sx/api/player.api.php?pass=undefined&cid3=undefined&key=%s&user=undefined&numOfErrors=1&errorUrl=%s&cid=1&file=%s&cid2=undefined&errorCode=404' % (filekey, urllib.quote_plus(stream_url), filename)
                html = self.net.http_GET(api).content
                r = re.search('url=(.+?)&title', html)
                if r:
                    stream_url = urllib.unquote(r.group(1))
                
            return stream_url
        except urllib2.HTTPError, e:
            common.addon.log_error('Nowvideo: got http error %d fetching %s' %
                                    (e.code, web_url))
            return self.unresolvable(code=3, msg=e)
class FlashxResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "flashx"
    domains = ["flashx.tv"]
    pattern = '(?://|\.)(flashx\.tv)/(?:embed-|dl\?)?([0-9a-zA-Z/-]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content

        r = re.search('href="([^"]+)', html)
        if r:
            web_url = r.group(1)
            html = self.net.http_GET(web_url).content

            try: html = jsunpack.unpack(re.search('(eval\(function.*?)</script>', html, re.DOTALL).group(1))
            except: pass

            best = 0
            best_link = ''

            for stream in re.findall('file\s*:\s*"(http.*?)"\s*,\s*label\s*:\s*"(\d+)', html, re.DOTALL):
                if int(stream[1]) > best:
                    best = int(stream[1])
                    best_link = stream[0]

        if best_link:
            return best_link
        else:
            raise UrlResolver.ResolverError('Unable to resolve Flashx link. Filelink not found.')
        
    def get_url(self, host, media_id):
        return 'http://www.flashx.tv/embed-%s.html' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False
    
    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host

    def get_settings_xml(self):
        xml = PluginSettings.get_settings_xml(self)
        xml += '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % (self.__class__.__name__)
        return xml
Exemplo n.º 19
0
class NosvideoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "nosvideo"
    domains = ["nosvideo.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        code = 0
        try:
            url = self.get_url(host, media_id)
            print url
            html = self.net.http_GET(url).content
            if 'File Not Found' in html:
                code = 1
                raise Exception('File Not Found')

            headers = {
                'Referer': url
            }

            data = {}
            r = re.findall(r'type="hidden" name="(.+?)"\s* value="(.+?)"', html)
            for name, value in r:
                data[name] = value
            data.update({'method_free': 'Free Download'})
            print data

            html = net.http_POST(url, data, headers=headers).content

            r = re.search('(eval\(function\(p,a,c,k,e,[dr].*)', html)
            if r:
                js = jsunpack.unpack(r.group(1))
                r = re.search('playlist=(.*)&config=', js)
                if r:
                    html = self.net.http_GET(r.group(1)).content
                    r = re.search('<file>\s*(.*)\s*</file>', html)
                    if r:
                        return r.group(1)
                    else:
                        raise Exception('Unable to locate video file')
                else:
                    raise Exception('Unable to locate playlist')
            else:
                raise Exception('Unable to locate packed data')

        except Exception, e:
            common.addon.log('**** Nosvideo Error occured: %s' % e)
            common.addon.show_small_popup('*** Nosvideo Error occured ***', str(e), 5000, '')
            return self.unresolvable(code=code, msg='Exception: %s' % e)
Exemplo n.º 20
0
class veeHDResolver(Plugin, UrlResolver, SiteAuth, PluginSettings):
    implements = [UrlResolver, SiteAuth, PluginSettings]
    name = "veeHD"
    profile_path = common.profile_path
    cookie_file = os.path.join(profile_path, '%s.cookies' % name)
    
    def __init__(self):
        p = self.get_setting('priority') or 1
        self.priority = int(p)
        self.net = Net()
        try:
            os.makedirs(os.path.dirname(self.cookie_file))
        except OSError:
            pass

    #UrlResolver methods
    def get_media_url(self, host, media_id):
        try:
            if not self.get_setting('login')=='true' or not (self.get_setting('username') and self.get_setting('password')):
                raise Exception('VeeHD requires a username & password')

            web_url = self.get_url(host, media_id)
            html = self.net.http_GET(web_url).content
            #print html.encode('ascii', 'ignore')

            # two possible playeriframe's: stream and download
            for match in re.finditer('playeriframe.+?src\s*:\s*"([^"]+)', html):
                player_url = 'http://%s%s'%(host,match.group(1))
                html = self.net.http_GET(player_url).content
                #print 'got player url: %s' % (player_url)
                
                # if the player html contains an iframe the iframe url has to be gotten and then the player_url tried again
                r = re.search('<iframe.*?src="([^"]+)', html)
                if r:
                    frame_url = 'http://%s%s'%(host,r.group(1))
                    #print 'got frame url: %s' % (frame_url)
                    self.net.http_GET(frame_url)
                    html = self.net.http_GET(player_url).content

                #print html.encode('ascii', 'ignore')
                patterns = ['"video/divx"\s+src="([^"]+)', '"url"\s*:\s*"([^"]+)', 'href="([^"]+(?:mp4|avi))']
                for pattern in patterns:
                    r = re.search(pattern, html)
                    if r:
                        stream_url = urllib.unquote(r.group(1))
                        #print 'pattern: %s matched in url: %s result: %s' % (pattern, player_url, stream_url)
                        return stream_url

            raise Exception ('File Not Found or Removed')
        except Exception, e:
            common.addon.log('**** VeeHD Error occured: %s' % e)
            return self.unresolvable(code=0, msg='Exception: %s' % e)    
Exemplo n.º 21
0
class MailRuResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mail.ru"
    domains = ["mail.ru"]
    pattern = '//((?:videoapi.)?my\.mail\.ru)/(?:videos/embed/)?mail/([^/]+)/(?:video/)?(?:st|tv)/([a-zA-Z0-9]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        match = re.search('"metadataUrl"\s*:\s*"([^"]+)', html)
        if match:
            json_url = match.group(1)
            response = self.net.http_GET(json_url)
            html = response.content
            if html:
                js_data = json.loads(html)
                headers = dict(response._response.info().items())
                stream_url = ''
                best_quality = 0
                for video in js_data['videos']:
                    if int(video['key'][:-1]) > best_quality:
                        stream_url = video['url']
                        best_quality = int(video['key'][:-1])
                    
                    if 'set-cookie' in headers:
                        stream_url += '|Cookie=%s' % (headers['set-cookie'])
                    
                if stream_url:
                    return stream_url

        raise UrlResolver.ResolverError('No playable video found.')

    def get_url(self, host, media_id):
        user, media_id = media_id.split('|')
        return 'http://videoapi.my.mail.ru/videos/embed/mail/%s/st/%s.html' % (user, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            host, user, media_id = r.groups()
            return host, '%s|%s' % (user, media_id)
        else:
            return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.search(self.pattern, url) or 'mail.ru' in host
Exemplo n.º 22
0
def ARTIST_SONG_INDEX(url,name):
        link=net.http_GET(url).content
        match = re.compile('http://www.musictory.com/(.+?)"').findall(link)
        url1 = 'http://www.musictory.com/'+match[0]+'/Songs'
        link1=net.http_GET(url1).content
        url = re.compile('<h1 itemprop="name">(.+?) Songs<').findall(link1)[0]
        match1 = re.compile('<span itemprop="name">(.+?)</span>').findall(link1)
        fanart = art+'Main/Fanart_A.jpg'
        for name in match1:
            name=name.encode('ascii','ignore')
            name = str(name).replace("&Agrave;","A").replace('&eacute;','e').replace('&ecirc;','e').replace('&egrave;','e').replace("&agrave;","A")
            addDir(name,'url',6,iconimage,fanart,1)
            setView('tvshow', 'DEFAULT')
class VideoMegaResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "videomega"
    domains = ["videomega.tv", "movieshd.co"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.headers = {'Referer':'http://videomega.tv/'}

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        stream_url = None
        self.headers['Referer'] = web_url
        html = self.net.http_GET(web_url, headers=self.headers).content
        if 'Error connecting to db' in html: raise UrlResolver.ResolverError('Error connecting to DB')
        # find the unescape string
        r = re.compile('document\.write\(unescape\("([^"]+)').findall(html)
        if r:
            unescaped_str = urllib.unquote(r[-1])
            r = re.search('file\s*:\s*"([^"]+)', unescaped_str)
            if r:
                stream_url = r.group(1)
                stream_url = stream_url.replace(" ", "%20")
        else:
            r = re.search('<source src="([^"]+)" type="video[^"]*"/>', html)
            if r: stream_url = r.group(1)
        if stream_url:
            xbmc.sleep(6000)
            return stream_url
        else: raise UrlResolver.ResolverError('No playable video found.')

    def get_url(self, host, media_id):
        if "movieshd.co" in host:
            return 'http://%s/iframe.php?ref=%s' % (host, media_id)
        else:  # For VideoMega.tv
            if len(media_id) == 60:
                try:
                    html = self.net.http_GET('http://%s/validatehash.php?hashkey=%s' % (host, media_id), headers=self.headers).content
                    # print html
                    if 'Error connecting to db' in html: return self.unresolvable(0, 'Error connecting to DB')
                    if 'ref=' in html:
                        return 'http://%s/cdn.php?ref=%s' % (host, re.compile('.*?ref="(.+?)".*').findall(html)[0])
                    else:
                        raise Exception('No playable video found.')
                except urllib2.URLError, e:
                    common.addon.log_error('Videomega: got http error %d fetching %s' % (e.code, 'http://%s/validatehash.php?hashkey=%s' % (host, media_id)))
                except Exception, e:
                    common.addon.log_error('**** Videomega Error occured: %s' % e)
            else:
class OpenLoadResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "openload"
    domains = ["openload.io", "openload.co"]
    pattern = "(?://|\.)(openload\.(?:io|co))/(?:embed|f)/([0-9a-zA-Z-_]+)"

    def __init__(self):
        p = self.get_setting("priority") or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        try:
            ticket_url = "https://api.openload.io/1/file/dlticket?file=%s" % (media_id)
            result = self.net.http_GET(ticket_url).content
            js_result = json.loads(result)
            if js_result["status"] != 200:
                raise UrlResolver.ResolverError(js_result["msg"])
            video_url = "https://api.openload.io/1/file/dl?file=%s&ticket=%s" % (
                media_id,
                js_result["result"]["ticket"],
            )
            captcha_url = js_result["result"].get("captcha_url", None)
            if captcha_url:
                captcha_response = captcha_lib.get_response(captcha_url)
                if captcha_response:
                    video_url += "&captcha_response=%s" % urllib.quote(captcha_response)
            xbmc.sleep(js_result["result"]["wait_time"] * 1000)
            result = self.net.http_GET(video_url).content
            js_result = json.loads(result)
            if js_result["status"] != 200:
                raise UrlResolver.ResolverError(js_result["msg"])

            return js_result["result"]["url"] + "?mime=true"
        except Exception as e:
            raise UrlResolver.ResolverError("Exception in openload: %s" % (e))

        raise UrlResolver.ResolverError("Unable to resolve openload.io link. Filelink not found.")

    def get_url(self, host, media_id):
        return "http://openload.io/embed/%s" % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
class SharerepoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "sharerepo"
    domains = ["sharerepo.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': USER_AGENT,
            'Referer': web_url
        }

        try:
            html = self.net.http_GET(web_url, headers=headers).content
        except urllib2.HTTPError as e:
            if e.code == 404:
                # sharerepo supports two different styles of links/media_ids
                # if the first fails, try the second kind
                web_url = 'http://sharerepo.com/%s' % media_id
                html = self.net.http_GET(web_url, headers=headers).content
            else:
                raise
            
        link = re.search("file\s*:\s*'([^']+)", html)
        if link:
            common.addon.log_debug('ShareRepo Link Found: %s' % link.group(1))
            return link.group(1) + '|User-Agent=%s' % (USER_AGENT)
        else:
            raise UrlResolver.ResolverError('Unable to resolve ShareRepo Link')

    def get_url(self, host, media_id):
        return 'http://sharerepo.com/f/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search('//(.+?)(?:/f)?/([0-9a-zA-Z]+)', url)
        if r:
            return r.groups()
        else:
            return False
        return('host', 'media_id')

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return (re.match('http://(www.)?sharerepo.com/(f/)?' +
                         '[0-9A-Za-z]+', url) or
                         'sharerepo' in host)
class MovshareResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "movshare"
    domains = ["movshare.net"]
    pattern = "//((?:www\.|embed\.)?movshare\.net)/(?:mobile/video\.php\?id=|video/|embed\.php\?v=)([0-9a-z]+)"

    def __init__(self):
        p = self.get_setting("priority") or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.net.http_HEAD(web_url)
        html = self.net.http_GET(web_url).content
        """movshare can do both flv and avi. There is no way I know before hand
        if the url going to be a flv or avi. So the first regex tries to find
        the avi file, if nothing is present, it will check for the flv file.
        "param name="src" is for avi
        "flashvars.file=" is for flv
        """
        r = re.search('<param name="src" value="(.+?)"', html)
        if not r:
            match = re.search('flashvars.filekey="(.+?)";', html)
            if match:
                # get stream url from api
                filekey = match.group(0)
                api = "http://www.movshare.net/api/player.api.php?key=%s&file=%s" % (filekey, media_id)
                html = self.net.http_GET(api).content
                r = re.search("url=(.+?)&title", html)
        if r:
            stream_url = r.group(1)
        else:
            raise UrlResolver.ResolverError("File Not Found or removed")

        return stream_url

    def get_url(self, host, media_id):
        return "http://www.movshare.net/video/%s" % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        if self.get_setting("enabled") == "false":
            return False
        return re.search(self.pattern, url) or "movshare" in host
class PlaywireResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "playwire"
    domains = ["playwire.com"]
    pattern = '(?://|\.)(cdn\.playwire\.com.+?\d+)/(?:config|embed)/(\d+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        if web_url.endswith('xml'):  # xml source
            root = ET.fromstring(html)
            stream = root.find('src')
            if stream is not None:
                stream = stream.text
                if stream.endswith('.f4m'):
                    html = self.net.http_GET(stream).content
                    try: return re.findall('<baseURL>(.+?)</baseURL>', html)[0] + '/' + re.findall('<media url="(.+?)"', html)[0]
                    except: pass
            else:
                accessdenied = root.find('Message')
                if accessdenied is not None:
                    raise UrlResolver.ResolverError('You do not have permission to view this content')

                raise UrlResolver.ResolverError('No playable video found.')
        else:  # json source
            r = re.search('"src":"(.+?)"', html)
            if r:
                return r.group(1)
            else:
                raise UrlResolver.ResolverError('No playable video found.')

    def get_url(self, host, media_id):
        if not 'v2' in host:
            return 'http://%s/embed/%s.xml' % (host, media_id)
        else:
            return 'http://%s/config/%s.json' % (host, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False
    
    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
class VideoHutResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "videohut.to"
    domains = [ "videohut.to" ]
    pattern = '(?://|\.)(videohut\.to)/(?:v\/|embed.php\?id=)([0-9a-z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content

        key = re.compile('key\s*:\s*[\'"](.+?)[\'"]').findall(html)
        if key:
            key = urllib.quote_plus(key[0]).replace('.', '%2E').replace('-', '%2D')

        filekey = re.compile('file\s*:\s*[\'"](.+?)[\'"]').findall(html)
        if filekey:
            filekey = urllib.quote_plus(filekey[0]).replace('.', '%2E').replace('-', '%2D')

        for i in range(0, 3):
            try:
                player_url = 'http://www.videohut.to/api/player.api.php?key=%s&file=%s' % (key, filekey)
                html = self.net.http_GET(player_url).content

                stream_url = re.search('url=(.+?)&', html).group(1)
                stream_url = urllib.unquote(stream_url)

                return stream_url
            except:
                pass

        raise UrlResolver.ResolverError('File Not Found or removed')

    def get_url(self, host, media_id):
            return 'http://www.videohut.to/embed.php?id=%s' % media_id
    
    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
class DivxstageResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = 'divxstage'
    domains = ['divxstage.eu', 'divxstage.net', 'divxstage.to', 'cloudtime.to']
    pattern = '(?://|\.)(divxstage.eu|divxstage.net|divxstage.to|cloudtime.to)/(?:video/|embed/\?v=)([A-Za-z0-9]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content

        r = re.search('flashvars.filekey=(.+?);', html)
        if r:
            r = r.group(1)

            try: filekey = re.compile('\s+%s="(.+?)"' % r).findall(html)[-1]
            except: filekey = r

            player_url = 'http://www.cloudtime.to/api/player.api.php?key=%s&file=%s' % (filekey, media_id)

            html = self.net.http_GET(player_url).content

            r = re.search('url=(.+?)&', html)

            if r:
                stream_url = r.group(1)
            else:
                raise UrlResolver.ResolverError('File Not Found or removed')

        return stream_url

    def get_url(self, host, media_id):
        return 'http://embed.cloudtime.to/embed.php?v=%s' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False
    
    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
Exemplo n.º 30
0
class veeHDResolver(Plugin, UrlResolver, SiteAuth, PluginSettings):
    implements = [UrlResolver, SiteAuth, PluginSettings]
    name = "veeHD"
    profile_path = common.profile_path
    cookie_file = os.path.join(profile_path, '%s.cookies' % name)
    
    def __init__(self):
        p = self.get_setting('priority') or 1
        self.priority = int(p)
        self.net = Net()
        try:
            os.makedirs(os.path.dirname(self.cookie_file))
        except OSError:
            pass

    #UrlResolver methods
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        try:
            html = self.net.http_GET(web_url).content

            fragment = re.search('playeriframe".+?attr.+?src : "(.+?)"', html)
            frag = 'http://%s%s'%(host,fragment.group(1))

            html = self.net.http_GET(frag).content

            r = re.search('"video/divx" src="(.+?)"', html)
            if r:
                stream_url = r.group(1)
            else:
                message = self.name + '- 1st attempt at finding the stream_url failed probably an Mp4, finding Mp4'
                common.addon.log_debug(message)
                a = re.search('"url":"(.+?)"', html)
                r=urllib.unquote(a.group(1))
                if r:
                    stream_url = r
                else:
                    raise Exception ('File Not Found or removed')
            return stream_url
        except urllib2.URLError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo)
            return False
        except Exception, e:
            common.addon.log('**** VeeHD Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]VEEHD[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return False
class ClickNUploadResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "clicknupload"
    domains = ["clicknupload.com", "clicknupload.me"]
    pattern = '(?://|\.)(clicknupload\.(?:com|me))/(?:f/)?([0-9A-Za-z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        tries = 0
        while tries < MAX_TRIES:
            data = {}
            r = re.findall(r'type="hidden"\s*name="([^"]+)"\s*value="([^"]+)',
                           html)
            for name, value in r:
                data[name] = value
            data['method_free'] = 'Free Download'
            data.update(captcha_lib.do_captcha(html))
            headers = {'Referer': web_url}
            html = self.net.http_POST(web_url, data, headers=headers).content
            if tries > 0:
                xbmc.sleep(6000)

            if '>File Download Link Generated<' in html:
                r = re.search("onClick\s*=\s*\"window\.open\('([^']+)", html)
                if r:
                    return r.group(1) + '|' + urllib.urlencode(
                        {'User-Agent': common.IE_USER_AGENT})

            tries = tries + 1

        raise UrlResolver.ResolverError('Unable to locate link')

    def get_url(self, host, media_id):
        return 'http://%s/%s' % (host, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
Exemplo n.º 32
0
class RealvidResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "Realvid"
    domains = ["realvid.net"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:www.)?realvid.net)/(?:embed-)?([0-9a-zA-Z]+)(?:-\d+x\d+.html)?'

    def get_url(self, host, media_id):
        return 'http://realvid.net/embed-%s-640x400.html' % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url) or self.name in host

    def get_media_url(self, host, media_id):
        try:
            web_url = self.get_url(host, media_id)
            link = self.net.http_GET(web_url).content

            if link.find('404 Not Found') >= 0:
                err_title = 'Content not available.'
                err_message = 'The requested video was not found.'
                common.addon.log_error(self.name +
                                       ' - fetching %s - %s - %s ' %
                                       (web_url, err_title, err_message))
                xbmc.executebuiltin('XBMC.Notification([B][COLOR white]' +
                                    __name__ + '[/COLOR][/B] - ' + err_title +
                                    ',[COLOR red]' + err_message +
                                    '[/COLOR],8000,' + logo + ')')
                return self.unresolvable(1, err_message)

            video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0])

            if len(video_link) > 0:
                return video_link
            else:
                return self.unresolvable(0, 'No playable video found.')
        except urllib2.URLError, e:
            return self.unresolvable(3, str(e))
        except Exception, e:
            return self.unresolvable(0, str(e))
Exemplo n.º 33
0
def abrir_url_tommy(url, referencia, form_data=None, erro=True):
    print "A fazer request tommy de: " + url
    from t0mm0.common.net import Net
    net = Net()
    try:
        if form_data == None: link = net.http_GET(url, referencia).content
        else:
            link = net.http_POST(url, form_data=form_data,
                                 headers=referencia).content.encode(
                                     'latin-1', 'ignore')
        return link

    except urllib2.HTTPError, e:
        return "Erro"
Exemplo n.º 34
0
class FlashxResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "flashx"
    domains = ["flashx.tv"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = '//((?:www.|play.)?flashx.tv)/(?:embed-|dl\?)?([0-9a-zA-Z/-]+)'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url}
        stream_url = self.__get_link(web_url, headers)
        if stream_url is None:
            headers['User-Agent'] = common.IOS_USER_AGENT
            stream_url = self.__get_link(web_url, headers)

        if stream_url is not None:
            return stream_url + '|User-Agent=%s' % (common.IE_USER_AGENT)

        raise UrlResolver.ResolverError('File not found')

    def __get_link(self, web_url, headers):
        html = self.net.http_GET(web_url, headers=headers).content
        for match in re.finditer('(eval\(function\(p,a,c,k,e,d\).*?)</script>',
                                 html, re.DOTALL):
            js = jsunpack.unpack(match.group(1))
            match2 = re.search('file\s*:\s*"([^"]+(?:video|mobile)[^"]+)', js)
            if match2:
                return match2.group(1)

    def get_url(self, host, media_id):
        return 'http://flashx.tv/embed-%s.html' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.search(self.pattern, url) or self.name in host

    def get_settings_xml(self):
        xml = PluginSettings.get_settings_xml(self)
        xml += '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % (
            self.__class__.__name__)
        return xml
Exemplo n.º 35
0
class MuchshareResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "muchshare"
    domains = ["muchshare.net"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        url = self.get_url(host, media_id)
        html = self.net.http_GET(url).content

        err = re.compile('<p class="err">(.+?)<br>').findall(html)
        if err:
            raise UrlResolver.ResolverError(str(err))

        data = {}
        r = re.findall(
            r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html)
        for name, value in r:
            data[name] = value
        data.update({'down_direct': 1})

        common.addon.show_countdown(45,
                                    title='Muchshare',
                                    text='Loading Video...')
        html = self.net.http_POST(url, data).content
        r = re.search(
            "(?:.+var file_link = \'|.+\<a id=\"lnk_download\" href=\")(.+?)(?:\'|\"\>)",
            html).group(1)
        r = urllib2.unquote(r)
        return r

    def get_url(self, host, media_id):
        return 'http://muchshare.net/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search('//(.+?)/([0-9a-zA-Z]+)', url)
        if r:
            return r.groups()
        else:
            return False
        return ('host', 'media_id')

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return (re.match('http://(www.)?muchshare.net/' + '[0-9A-Za-z]+', url)
                or 'muchshare' in host)
Exemplo n.º 36
0
class VideoTTResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "videott"
    domains = ["video.tt"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://(?:www\.)?(video\.tt)/(?:video\/|embed\/|watch_video\.php\?v=)(\w+)'

    def get_media_url(self, host, media_id):
        json_url = 'http://www.video.tt/player_control/settings.php?v=%s' % media_id

        try:
            json = self.net.http_GET(json_url).content
            data = loads(json)

            vids = data['settings']['res']

            if not vids:
                err_title = 'Content not available.'
                err_message = 'The requested video was not found.'
                common.addon.log_error(self.name +
                                       ' - fetching %s - %s - %s ' %
                                       (json_url, err_title, err_message))
                return self.unresolvable(1, err_message)

            else:
                vUrlsCount = len(vids)

                if (vUrlsCount > 0):
                    q = self.get_setting('quality')
                    # Lowest Quality
                    li = 0

                    if q == '1':
                        # Medium Quality
                        li = (int)(vUrlsCount / 2)
                    elif q == '2':
                        # Highest Quality
                        li = vUrlsCount - 1

                    vUrl = vids[li]['u'].decode('base-64')
                    return vUrl

        except urllib2.URLError, e:
            return self.unresolvable(3, str(e))
        except Exception, e:
            return self.unresolvable(0, str(e))
Exemplo n.º 37
0
class VideowoodResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "videowood"
    domains = ['videowood.tv']
    pattern = '//((?:www.)?videowood.tv)/(?:embed/|video/)([0-9a-z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        stream_url = None
        headers = {'Referer': web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        if "This video doesn't exist." in html:
            raise UrlResolver.ResolverError(
                'The requested video was not found.')
        packed = re.search('(eval\(function\(p,a,c,k,e,d\)\{.+\))', html)
        unpacked = None
        if packed:
            # change radix before trying to unpack, 58-61 seen in testing, 62 worked for all
            packed = re.sub(
                r"(.+}\('.*', *)\d+(, *\d+, *'.*?'\.split\('\|'\))",
                "\g<01>62\g<02>", packed.group(1))
            unpacked = jsunpack.unpack(packed)
        if unpacked:
            r = re.search('.+["\']file["\']\s*:\s*["\'](.+?/video\\\.+?)["\']',
                          unpacked)
            if r:
                stream_url = r.group(1).replace('\\', '')
        if stream_url:
            return stream_url
        else:
            raise UrlResolver.ResolverError('File not found')

    def get_url(self, host, media_id):
        return 'http://%s/embed/%s' % (host, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.search(self.pattern, url) or self.name in host
Exemplo n.º 38
0
class FilenukeResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "play44.net"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        # http://play44.net/embed.php?w=718&h=438&vid=og/saint_seiya_omega_-_69.mp4
        self.pattern = 'http://((?:www.)?play44.net)/embed\.php?.*?vid=([0-9a-zA-Z_\-\./]+)[\?&]*'
        #self.pattern = 'http://((?:www.)?videofun.me)/embed/(.+?)'

    def get_url(self, host, media_id):
        return 'http://play44.net/embed.php?&vid=%s' % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url) or self.name in host

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        post_url = web_url
        hostname = self.name
        common.addon.log(media_id)
        common.addon.log(web_url)
        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
        except urllib2.URLError, e:
            common.addon.log_error(hostname +
                                   ': got http error %d fetching %s' %
                                   (e.code, web_url))
            return self.unresolvable(code=3,
                                     msg='Exception: %s' % e)  #return False
        r = re.search(
            "playlist:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*'(.+?)'",
            html)
        if r:
            stream_url = urllib.unquote_plus(r.group(1))
            print stream_url
        else:
            common.addon.log_error(hostname + ': stream url not found')
            return self.unresolvable(code=0,
                                     msg='no file located')  #return False
        return stream_url
class StreamcloudResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "streamcloud"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
            post_url = resp.get_url()
            dialog = xbmcgui.Dialog()

            if re.search('>(File Not Found)<', html):
                raise Exception('File Not Found or removed')

            form_values = {}
            for i in re.finditer('<input.*?name="(.*?)".*?value="(.*?)">',
                                 html):
                form_values[i.group(1)] = i.group(2).replace(
                    "download1", "download2")
            #wait required
            #common.addon.show_countdown(11)
            html = self.net.http_POST(post_url, form_data=form_values).content

            r = re.search('file: "(.+?)",', html)
            if r:
                return r.group(1)
            else:
                raise Exception('File Not Found or removed')
        except urllib2.URLError, e:
            common.addon.log_error(self.name +
                                   ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error', 'Http error: ' + str(e),
                                          8000, error_logo)
            return self.unresolvable(code=3, msg=e)
        except Exception, e:
            common.addon.log('**** Streamcloud Error occured: %s' % e)
            common.addon.show_small_popup(
                title='[B][COLOR white]STREAMCLOUD[/COLOR][/B]',
                msg='[COLOR red]%s[/COLOR]' % e,
                delay=5000,
                image=error_logo)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 40
0
class FilenukeResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "filenuke"
    domains = [ "filenuke.com" ]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()


    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        try:
            headers = {
                'User-Agent': USER_AGENT,
                'Referer': web_url
            }
           # Otherwise just use the original url to get the content. For sharesix
            html = self.net.http_GET(web_url).content
            
            data = {}
            r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html)
            for name, value in r:
                data[name] = value
            #data[u"method_premium"] = "Premium"; 
            data[u"method_free"] = "Free"; 
            data[u"op"] = "download1"; data[u"referer"] = web_url; data[u"usr_login"] = "";
            html = self.net.http_POST(web_url, data, headers=headers).content
            
            r = re.search("var\s+lnk1\s*=\s*'(.*?)'", html)
            if r:
                stream_url=r.group(1)+'|User-Agent=%s' % (USER_AGENT)
                return stream_url
            else:
                raise Exception('Unable to locate link')
            
            if 'file you were looking for could not be found' in html:
                raise Exception ('File Not Found or removed')

        except urllib2.HTTPError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo)
            return self.unresolvable(code=3, msg=e)
        except Exception, e:
            common.addon.log_error('**** Sharesix Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]SHARESIX[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 41
0
class AaaaAnimeUploaderResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "si_animeuploader"
    domains = ["animeuploader.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.pattern = 'http[s]*://(.*?(?:animeuploader)\.com)/embed\.php\?video=(.+?)(?:&.*|$)'
        self.net = Net()
        self.user_agent = common.IE_USER_AGENT
        self.net.set_user_agent(self.user_agent)
        self.headers = {'User-Agent': self.user_agent}

    def get_url(self, host, media_id):
        return 'http://%s//embed.php?video=%s' % (host, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url)

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        r = re.search('\s*?sources:\s*?\[\s*?\{\s*?file:\s*?[\'"](.+?)[\'"].*',
                      html)
        if r:
            return self.__add_headers_for_kodi(r.group(1))
        else:
            raise UrlResolver.ResolverError('File not found')

    def __add_headers_for_kodi(self, url):
        _referer = urllib.quote_plus('http://%s/' % self.domains[0])
        _user_agent = urllib.quote_plus(self.net._user_agent)
        _connection_timeout = '60'
        _cookies = ''
        for _cookie in self.net._cj:
            _cookies += urllib.quote_plus('%s=%s;' %
                                          (_cookie.name, _cookie.value))
        if _cookies:
            return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \
                   (url, _referer, _user_agent, _connection_timeout, _cookies)
        else:
            return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \
                   (url, _referer, _user_agent, _connection_timeout)
Exemplo n.º 42
0
class TrollVidResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "trollvid.net"
    domains = ["trollvid.net"]
    pattern = '(?://|\.)(trollvid\.net)/embed\.php.file=([0-9a-zA-Z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content

        try:
            stream_url = re.search('url\s*:\s*"(http.+?)"', html).group(1)
        except:
            pass

        try:
            stream_url = re.search('atob\(\'(.+?)\'', html).group(1)
        except:
            pass

        try:
            stream_url = base64.b64decode(stream_url)
        except:
            pass

        try:
            stream_url = urllib.unquote_plus(stream_url)
        except:
            pass

        return stream_url

    def get_url(self, host, media_id):
        return 'http://trollvid.net/embed.php?file=%s' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
Exemplo n.º 43
0
class MovDivxResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "movdivx"
    domains = ["movdivx.com"]
    pattern = '(?://|\.)(movdivx\.com)/([0-9a-zA-Z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content

        data = {}
        for match in re.finditer('type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html):
            key, value = match.groups()
            data[key] = value
        data['method_free'] = 'Continue to Stream >>'
        
        html = self.net.http_POST(web_url, data).content

        # get url from packed javascript
        sPattern = '(eval\(function\(p,a,c,k,e,d\).*?)</script>'
        for match in re.finditer(sPattern, html, re.DOTALL | re.IGNORECASE):
            fragment = match.group(1)
            js_data = jsunpack.unpack(fragment)
            match = re.search('name="src"\s*value="([^"]+)', js_data)
            if match:
                return match.group(1)
            else:
                match = re.search('file\s*:\s*"([^"]+)', js_data)
                if match:
                    return match.group(1)

        raise UrlResolver.ResolverError('failed to parse link')

    def get_url(self, host, media_id):
            return 'http://movdivx.com/%s.html' % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False
    
    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
Exemplo n.º 44
0
class FilenukeResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "uploadcrazy.net"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        # http://video.vidcrazy.net/nvs.php?file=tenkai-knights06&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg
        # http://video.vidcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg
        # http://embeds.uploadcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/H1dqUbf.jpg
        self.pattern = 'http://((?:embeds.)?uploadcrazy.net)/(\D+.php\?file=[0-9a-zA-Z\-_]+)[&]*'
        #self.pattern = 'http://((?:www.)?vidcrazy.net)/embed/(.+?)'

    def get_url(self, host, media_id):
        return 'http://embeds.uploadcrazy.net/%s' % (media_id)
        #return 'http://embeds.uploadcrazy.net/embed.php?file=%s' % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url) or self.name in host

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        post_url = web_url
        hostname = self.name
        common.addon.log(web_url)
        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
        except urllib2.URLError, e:
            common.addon.log_error(hostname +
                                   ': got http error %d fetching %s' %
                                   (e.code, web_url))
            return self.unresolvable(code=3,
                                     msg='Exception: %s' % e)  #return False
        #print html
        r = re.search("'file'\s*:\s*'(.+?)'", html)
        if r:
            stream_url = urllib.unquote_plus(r.group(1))
        else:
            common.addon.log_error(hostname + ': stream url not found')
            return self.unresolvable(code=0,
                                     msg='no file located')  #return False
        return stream_url
Exemplo n.º 45
0
def abrir_url_cookie(url):
    from t0mm0.common.net import Net
    net = Net()
    net.set_cookies(cookie_nos)
    try:
        link = net.http_GET(url).content.encode('latin-1', 'ignore')
        return link
    except urllib2.HTTPError, e:
        mensagemok(
            'Hotspot Connector',
            str(
                urllib2.HTTPError(e.url, e.code, 'Erro a abrir página', e.hdrs,
                                  e.fp)), traducao(40200))
        sys.exit(0)
Exemplo n.º 46
0
class MooShareResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mooshare"
    domains = ["mooshare.biz"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        url = self.get_url(host, media_id)
        html = self.net.http_GET(url).content

        data = {}
        if '<form role="search"' in html and '<Form method="POST" action=\'\'>' in html:
            html = html.split('<Form method="POST" action=\'\'>')[1]
        r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html)
        for name, value in r:
            data[name] = value
        data[u'referer'] = ''
        data[u'usr_login'] = ''
        data[u'imhuman'] = 'Proceed to video'
        data[u'btn_download'] = 'Proceed to video'
        xbmc.sleep(5000)
        html = self.net.http_POST(url, data).content

        r = re.search('file\s*:\s*"(.+?)"', html)
        if r:
            return r.group(1)
        else:
            raise UrlResolver.ResolverError('could not find video')

    def get_url(self, host, media_id):
        return 'http://mooshare.biz/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)', url)
        if r:
            return r.groups()
        else:
            return False
        return ('host', 'media_id')

    def valid_url(self, url, host):
        return (re.match(
            'http://(www.)?mooshare.biz/[0-9A-Za-z]+', url
        ) or re.match(
            'http://(www.)?mooshare.biz/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*',
            url) or 'mooshare' in host)
Exemplo n.º 47
0
class NovamovResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "novamov"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        #find key
        try:
            html = self.net.http_GET(web_url).content
            html = unwise.unwise_process(html)
            filekey = unwise.resolve_var(html, "flashvars.filekey")
            
            #get stream url from api
            api = 'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filekey, media_id)
            html = self.net.http_GET(api).content
            r = re.search('url=(.+?)&title', html)
            if r:
                stream_url = urllib.unquote(r.group(1))
            else:
                r = re.search('file no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')
            
            return stream_url
        except urllib2.URLError, e:
            common.addon.log_error('Novamov: got http error %d fetching %s' %
                                    (e.code, web_url))
            return False
        except Exception, e:
            common.addon.log_error('**** Novamov Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]NOVAMOV[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return False
Exemplo n.º 48
0
class DaclipsResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "daclips"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        #e.g. http://daclips.com/vb80o1esx2eb
        self.pattern = 'http://((?:www.)?daclips.(?:in|com))/([0-9a-zA-Z]+)'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        """ Human Verification """
        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
            r = re.findall(
                r'<span class="t" id="head_title">404 - File Not Found</span>',
                html)
            if r:
                raise Exception('File Not Found or removed')
            post_url = resp.get_url()
            form_values = {}
            for i in re.finditer(
                    '<input type="hidden" name="(.+?)" value="(.+?)">', html):
                form_values[i.group(1)] = i.group(2)
            html = self.net.http_POST(post_url, form_data=form_values).content
            r = re.search('file: "http(.+?)"', html)
            if r:
                return "http" + r.group(1)
            else:
                raise Exception('Unable to resolve Daclips link')

        except urllib2.URLError, e:
            common.addon.log_error('daclips: got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error', 'Http error: ' + str(e),
                                          5000, error_logo)
            return self.unresolvable(code=3, msg=e)

        except Exception, e:
            common.addon.log_error('**** Daclips Error occured: %s' % e)
            common.addon.show_small_popup(
                title='[B][COLOR white]DACLIPS[/COLOR][/B]',
                msg='[COLOR red]%s[/COLOR]' % e,
                delay=5000,
                image=error_logo)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 49
0
class XvidstageResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "xvidstage"
    domains = ["xvidstage.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:www.)?xvidstage.com)/([0-9A-Za-z]+)'
        # http://xvidstage.com/59reflvbp02z

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        try:
            html = self.net.http_GET(web_url).content

            # removed check.
            # get url from packed javascript
            sPattern = "src='http://xvidstage.com/player/swfobject.js'></script>.+?<script type='text/javascript'>eval.*?return p}\((.*?)</script>"  # Modded
            r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
            if r:
                sJavascript = r.group(1)
                sUnpacked = jsunpack.unpack(sJavascript)
                sPattern = "'file','(.+?)'"  #modded
                r = re.search(sPattern, sUnpacked)
                if r:
                    return r.group(1)
                raise Exception('File Not Found or removed')

            raise Exception('File Not Found or removed')

        except urllib2.URLError, e:
            common.addon.log_error(self.name +
                                   ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error', 'Http error: ' + str(e),
                                          8000, error_logo)
            return self.unresolvable(code=3, msg=e)

        except Exception, e:
            common.addon.log('**** Xvidstage Error occured: %s' % e)
            common.addon.show_small_popup(
                title='[B][COLOR white]XVIDSTAGE[/COLOR][/B]',
                msg='[COLOR red]%s[/COLOR]' % e,
                delay=5000,
                image=error_logo)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 50
0
class JumbofilesResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "jumbofiles"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        try:
            common.addon.log('jumbofiles: in get_media_url %s %s' %
                             (host, media_id))
            web_url = self.get_url(host, media_id)
            html = self.net.http_GET(web_url).content

            dialog = xbmcgui.Dialog()

            if 'file has been removed' in html:
                raise Exception('File has been removed.')

            form_values = {}
            for i in re.finditer(
                    '<input type="hidden" name="(.+?)" value="(.+?)">', html):
                form_values[i.group(1)] = i.group(2)

            html = self.net.http_POST(web_url, form_data=form_values).content
            match = re.search('ACTION="(.+?)"', html)
            if match:
                return match.group(1)
            else:
                raise Exception('failed to parse link')

        except urllib2.URLError, e:
            common.addon.log_error(
                'Jumbofiles: got http error %d fetching %s' %
                (e.code, web_url))
            common.addon.show_small_popup('Error', 'Http error: ' + str(e),
                                          5000, error_logo)
            return self.unresolvable(code=3, msg=e)

        except Exception, e:
            common.addon.log_error('**** Jumbofiles Error occured: %s' % e)
            common.addon.show_small_popup(
                title='[B][COLOR white]JUMBOFILES[/COLOR][/B]',
                msg='[COLOR red]%s[/COLOR]' % e,
                delay=5000,
                image=error_logo)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 51
0
class YouWatchResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "youwatch"
    domains = ["youwatch.org"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = '//((?:www.)?youwatch.org)/(?:embed-)?([A-Za-z0-9]+)(?:-\d+x\d+\.html)?'
            
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
                   'Referer': web_url
        }
        tries = 0
        while tries < MAX_TRIES:
            html = self.net.http_GET(web_url, headers=headers).content
            r = re.search('<iframe[^>]*src="([^"]+/embed[^"]+)', html)
            if r:
                headers['Referer'] = web_url
                web_url = r.group(1)
            else:
                break
            tries += 1
        
        for match in re.finditer('(eval\(function.*?)</script>', html, re.DOTALL):
            js_data = jsunpack.unpack(match.group(1))
            match2 = re.search('file\s*:\s*"([^"]+)', js_data)
            if match2:
                return match2.group(1) + '|User-Agent=%s' % (common.IE_USER_AGENT)
    
        raise UrlResolver.ResolverError('Unable to resolve youwatch link. Filelink not found.')

    def get_url(self, host, media_id):
        return 'http://youwatch.org/embed-%s-640x360.html' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': 
            return False
        return re.search(self.pattern, url) or 'youwatch' in host
Exemplo n.º 52
0
class UploadcResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "uploadc"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:www.)?uploadc.com)/([0-9a-zA-Z]+)'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        #get html
        try:
            html = self.net.http_GET(web_url).content
        except urllib2.URLError, e:
            common.addon.log_error(self.name +
                                   ': got http error %d fetching %s' %
                                   (e.code, api_url))

        #send all form values
        sPattern = '<input.*?name="([^"]+)".*?value=([^>]+)>'
        r = re.findall(sPattern, html)
        data = {}
        if r:
            for match in r:
                name = match[0]
                value = match[1].replace('"', '')
                data[name] = value

            html = self.net.http_POST(web_url, data).content
        else:
            common.addon.log_error(self.name + ': no fields found')
            return False

        # get url from packed javascript
        r = re.findall(
            "<script type='text/javascript'>eval.*?return p}" +
            "\((.*?)\)\s*</script>", html, re.DOTALL + re.IGNORECASE)
        if r:
            sJavascript = r[1]
            sUnpacked = jsunpack.unpack(sJavascript)
            sPattern = '<param name="src"0="(.*?)"'
            r = re.search(sPattern, sUnpacked)
            if r:
                return r.group(1)

        return False
Exemplo n.º 53
0
class VshareResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "vshare"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:www.)?vshare.io)/\w?/(\w+)(?:\/width-\d+/height-\d+/)?'

    def get_url(self, host, media_id):
        return 'http://vshare.io/v/%s/width-620/height-280/' % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r: return r.groups()
        else: return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url) or self.name in host

    def get_media_url(self, host, media_id):
        try:
            web_url = self.get_url(host, media_id)
            link = self.net.http_GET(web_url).content

            if link.find('404 - Error') >= 0:
                err_title = 'Content not available.'
                err_message = 'The requested video was not found.'
                common.addon.log_error(self.name +
                                       ' - fetching %s - %s - %s ' %
                                       (web_url, err_title, err_message))
                xbmc.executebuiltin('XBMC.Notification([B][COLOR white]' +
                                    __name__ + '[/COLOR][/B] - ' + err_title +
                                    ',[COLOR red]' + err_message +
                                    '[/COLOR],8000,' + logo + ')')
                return self.unresolvable(1, err_message)

            video_link = str(re.compile("url[: ]*'(.+?)'").findall(link)[0])

            if len(video_link) > 0:
                return video_link
            else:
                return self.unresolvable(0, 'No playable video found.')
        except urllib2.URLError, e:
            return self.unresolvable(3, str(e))
        except Exception, e:
            return self.unresolvable(0, str(e))
Exemplo n.º 54
0
class StreamintoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "streaminto"
    domains = ["streamin.to"]
    pattern = '(?://|\.)(streamin\.to)/(?:embed-|)?([0-9A-Za-z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content

        try:
            stream_url = re.compile(
                "file\s*:\s*[\'|\"](http.+?)[\'|\"]").findall(html)[0]
            r = urllib2.Request(stream_url,
                                headers={'User-Agent': common.IE_USER_AGENT})
            r = urllib2.urlopen(r, timeout=15).headers['Content-Length']
            return stream_url
        except:
            pass

        try:
            streamer = re.search('streamer:\s*"([^"]+)",',
                                 html).group(1).replace(':1935', '')
            playpath = re.search('file:\s*"([^"]+)",',
                                 html).group(1).replace('.flv', '')
            return '%s playpath=%s' % (streamer, playpath)
        except:
            pass

        raise UrlResolver.ResolverError('File Not Found or removed')

    def get_url(self, host, media_id):
        return 'http://streamin.to/embed-%s.html' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
Exemplo n.º 55
0
class VidstreamResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "vidstream"
    domains = ["vidstream.in"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        #e.g. http://vidstream.in/xdfaay6ccwqj
        self.pattern = 'http://((?:www.)?vidstream.in)/(.*)'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        try:
            resp = self.net.http_GET(web_url)

            html = resp.content
            post_url = resp.get_url()

            # get post vars
            form_values = {}
            for i in re.finditer('<input.*?name="(.*?)".*?value="(.*?)">',
                                 html):
                form_values[i.group(1)] = i.group(2)
            html = self.net.http_POST(post_url, form_data=form_values).content

            # get stream url
            pattern = 'file:\s*"([^"]+)",'
            r = re.search(pattern, html)
            if r:
                return r.group(1)

            raise Exception('File Not Found or removed')
        except urllib2.URLError, e:
            common.addon.log_error(self.name +
                                   ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error', 'Http error: ' + str(e),
                                          8000, error_logo)
            return self.unresolvable(code=3, msg=e)
        except Exception, e:
            common.addon.log('**** Vidstream Error occured: %s' % e)
            common.addon.show_small_popup(
                title='[B][COLOR white]VIDSTREAM[/COLOR][/B]',
                msg='[COLOR red]%s[/COLOR]' % e,
                delay=5000,
                image=error_logo)
            return self.unresolvable(code=0, msg=e)
Exemplo n.º 56
0
class BayfilesResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "bayfiles"
    domains = ["bayfiles.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        found = re.search(r'var vfid = (\d+);\s*var delay = (\d+);', html)
        vfid, delay = found.groups()
        response = json.loads(
            self.net.http_POST('http://bayfiles.com/ajax_download', {
                "_": wait() * 1000,
                "action": "startTimer",
                "vfid": vfid
            }).content)
        common.addon.show_countdown(int(delay),
                                    '[B][COLOR orange]BAYFILES[/COLOR][/B]',
                                    '')
        html = self.net.http_POST('http://bayfiles.com/ajax_download', {
            "token": response['token'],
            "action": "getLink",
            "vfid": vfid
        }).content
        final_link = re.search(r"javascript:window.location.href = '([^']+)';",
                               html)
        if final_link:
            return final_link.group(1)
        else:
            raise UrlResolver.ResolverError('Unable to resolve link')

    def get_url(self, host, media_id):
        return 'http://%s.com/file/uMXL/%s' % (host, media_id)

    def get_host_and_id(self, url):
        r = re.match(r'http://(bayfiles).com/file/uMXL/([a-zA-Z0-9._/]+)', url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return (re.match(r'http://(bayfiles).com/file/uMXL/([a-zA-Z0-9._/]+)',
                         url) or 'bayfiles' in host)
Exemplo n.º 57
0
class VidxdenResolver(Plugin, gozlanurlresolver, PluginSettings):
    implements = [gozlanurlresolver, PluginSettings]
    name = "vidxden"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        """ Human Verification """
        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
            post_url = resp.get_url()

            form_values = {}
            for i in re.finditer('<input name="(.+?)".+?value="(.+?)"', html):
                form_values[i.group(1)] = i.group(2)

            html = self.net.http_POST(post_url, form_data=form_values).content

        except urllib2.URLError, e:
            common.addon.log_error('vidxden: got http error %d fetching %s' %
                                   (e.code, web_url))
            return False

        #find packed javascript embed code
        r = re.search('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split', html)
        if r:
            p, k = r.groups()
        else:
            common.addon.log_error(
                'vidxden: packed javascript embed code not found')

        decrypted_data = unpack_js(p, k)

        #First checks for a flv url, then the if statement is for the avi url
        r = re.search('file.\',.\'(.+?).\'', decrypted_data)
        if not r:
            r = re.search('src="(.+?)"', decrypted_data)
        if r:
            stream_url = r.group(1)
        else:
            common.addon.log_error('vidxden: stream url not found')
            return False

        return stream_url
Exemplo n.º 58
0
class StreamintoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "streaminto"
    domains = ["streamin.to"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        #e.g. http://streamin.to/20xk6r5vpkch
        self.pattern = 'http://((?:www.)?streamin.to)/(.*)'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        resp = self.net.http_GET(web_url)
        html = resp.content
        post_url = web_url

        # get post vars
        form_values = {}
        for i in re.finditer('<input.*?name="(.*?)".*?value="(.*?)">', html):
            form_values[i.group(1)] = i.group(2)
        xbmc.sleep(5000)
        html = self.net.http_POST(post_url, form_data=form_values).content

        # get stream url
        pattern = 'streamer:\s*"([^"]+)",'  # streamer: "
        file = 'file:\s*"([^"]+)",'  # streamer: "
        r = re.search(pattern, html)
        rr = re.search(file, html)
        if r:
            return r.group(1).replace(
                ':1935', ''
            ) + ' swfUrl=http://streamin.to/player/player.swf live=false swfVfy=1 playpath=' + rr.group(
                1).replace('.flv', '')
        raise UrlResolver.ResolverError('File Not Found or removed')

    def get_url(self, host, media_id):
        return 'http://streamin.to/%s' % (media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.match(self.pattern, url) or self.name in host
Exemplo n.º 59
0
class OneeightyuploadResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "180upload"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        print '180upload: in get_media_url %s %s' % (host, media_id)
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content

        form_values = {}
        for i in re.finditer(
                '<input type="hidden" name="(.+?)" value="(.+?)">', html):
            form_values[i.group(1)] = i.group(2)

        html = self.net.http_POST(web_url, form_data=form_values).content
        match = re.search(
            '<span style="background:#f9f9f9;border:1px dotted #bbb;padding:7px;">.+?<a href="(.+?)">',
            html, re.DOTALL)
        if not match:
            print 'could not find video'
            return False
        return match.group(1)

    def get_url(self, host, media_id):
        print '180upload: in get_url %s %s' % (host, media_id)
        return 'http://www.180upload.com/%s' % media_id

    def get_host_and_id(self, url):
        print '180upload: in get_host_and_id %s' % (url)

        r = re.search('http://(.+?)/embed-([\w]+)-', url)
        if r:
            return r.groups()
        else:
            r = re.search('//(.+?)/([\w]+)', url)
            if r:
                return r.groups()
            else:
                return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return (re.match('http://(www.)?180upload.com/' + '[0-9A-Za-z]+', url)
                or '180upload' in host)
class GorillavidResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "gorillavid.com"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        #e.g. http://gorillavid.com/vb80o1esx2eb
        #e.g. http://gorillavid.com/embed-u5w242qpjkb1-960x480.html
        self.pattern = 'http://((?:www.)?gorillavid.com)/[embed]*\-*([0-9a-zA-Z]+)'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        """ Human Verification """
        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
            r = re.findall(r"<title>404 - Not Found</title>", html)
            if r:
                raise Exception('File Not Found or removed')
            post_url = resp.get_url()
            form_values = {}
            for i in re.finditer(
                    '<input type="hidden" name="(.+?)" value="(.+?)">', html):
                form_values[i.group(1)] = i.group(2)

            html = self.net.http_POST(post_url, form_data=form_values).content
            r = re.search('file: "(.+?)"', html)
            if r:
                return r.group(1)

            raise Exception('File Not Found or removed')
        except urllib2.URLError, e:
            common.addon.log_error(
                'gorillavid: got http error %d fetching %s' %
                (e.code, web_url))
            common.addon.show_small_popup('Error', 'Http error: ' + str(e),
                                          5000, error_logo)
            return False

        except Exception, e:
            common.addon.log_error('**** Gorillavid Error occured: %s' % e)
            common.addon.show_small_popup(
                title='[B][COLOR white]GORILLAVID[/COLOR][/B]',
                msg='[COLOR red]%s[/COLOR]' % e,
                delay=5000,
                image=error_logo)
            return False