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
Example #2
0
def PostContent(formvar,url):
        try:
                net = Net()
                headers = {}
                headers['Accept']='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
                headers['Accept-Encoding'] = 'gzip, deflate'
                headers['Accept-Charset']='ISO-8859-1,utf-8;q=0.7,*;q=0.7'
                headers['Referer'] = 'http://www.khmeraccess.com/video/videolist/videonew.html?cid=1'
                headers['Content-Type'] = 'application/x-www-form-urlencoded'
                headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1'
                headers['Connection'] = 'keep-alive'
                headers['Host']='www.khmeraccess.com'
                headers['Accept-Language']='en-us,en;q=0.5'
                headers['Pragma']='no-cache'
                formdata={}                      
                formdata['start']=formvar


                #first_response = net.http_Get('http://khmerfever.com/wp-login.php',headers=header_dict)
                #net.save_cookies('c:\cookies.txt')
                #net.set_cookies('c:\cookies.txt')
                second_response = net.http_POST(url,formdata,headers=headers,compression=False)
                return second_response.content
        except: 
                d = xbmcgui.Dialog()
                d.ok('Time out',"Can't Connect to site",'Try again in a moment')
class FilenukeResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "filenuke"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        #e.g. http://www.filenuke.com/embed-rw52re7f5aul.html
        # http://www.filenuke.com/w8w7ow5nqu7r
        self.pattern = 'http://((?:www.)?filenuke.com)/([0-9a-zA-Z]+)'


    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()
            form_values = {}

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

            for i in re.finditer('<input type="submit" name="(.+?)" class="btn-big2-2" style="border: none;" value="(.+?)">', html):
                form_values[i.group(1)] = i.group(2)
                
            form_values[u'usr_login'] = u''
            form_values[u'referer'] = u''
            form_values[u'op'] = u'download1'
            html = self.net.http_POST(post_url, form_data=form_values).content
            r = re.findall('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split',html)
            if r:
                p = r[1][0]
                k = r[1][1]
            else:
                raise Exception ('File Not Found or removed')

            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:
                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), 5000, error_logo)
            return self.unresolvable(code=3, msg=e)
        except Exception, e:
            common.addon.log_error('**** Filenuke Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]FILENUKE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return self.unresolvable(code=0, msg=e)
class playedResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "played"

    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,{'host':'played.to'}).content
        id=re.compile('<input type="hidden" name="id" value="(.+?)">').findall(html)[0]
        fname=re.compile('<input type="hidden" name="fname" value="(.+?)">').findall(html)[0]
        hash=re.compile('<input type="hidden" name="hash" value="(.+?)">').findall(html)[0]
        data={'op':'download1','usr_login':'','id':id,'fname':fname,'referer':'','hash':hash,'imhuman':'Continue+to+Video'}
        html=self.net.http_POST(web_url,data).content
        played=re.compile('file: "(.+?)"').findall(html)[0]
        return played

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

    def get_host_and_id(self, url):
        r = re.match(r'http://(played).to/([0-9a-zA-Z]+)', 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(r'http://(played).to/([0-9a-zA-Z]+)', url) or 'played' in host
Example #5
0
def noswifi():
        #obrigado darkstar pelos tiros a escura
        checkurl = "http://example.com"
        html=abrir_url_cookie(checkurl)
        
        if html.find('action="https://zon.portal.fon.com') >= 0:
            print "Info inicial: " + str(html)
            m = re.search('action="(https://zon.[^"]+)"',html)
            if(m == None):
                  mensagemok('Hotspot Connector',"Actionurl não encontrado.","Volte a tentar mais tarde.")
                  return
            
            actionUrl = m.group(1)

            from t0mm0.common.net import Net
            net=Net()
            net.set_cookies(cookie_nos)
            data = {'USERNAME' : noswifiUsername, 'PASSWORD' : noswifiPassword,'remember':'on'}
            ref_data = {'User-Agent':user_agent}
            html= net.http_POST(actionUrl,form_data=data,headers=ref_data).content.encode('latin-1','ignore')

            print "Teste Login: "******"error"><span>([^<]+)<br /></span></div>', html)
            if(m == None):                
                
                try: addLink('[B]Login efectuado ou não necessário[/B]','',wtpath + art + 'noswifi.png')
                except: pass
            else:
                try: addLink(m.group(1),'',wtpath + art + 'noswifi.png')
                except: pass
        else:
            try: addLink('[B]Login efectuado ou não necessário[/B]','',wtpath + art + 'noswifi.png')
            except: pass
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)
class playedResolver(Plugin,UrlResolver,PluginSettings):
    implements=[UrlResolver,PluginSettings]
    name="played"
    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,{'host':'played.to'}).content
            try:
                played=re.compile('file: "(.+?)"').findall(html)[0]
                if len(played) > 12: return played
            except: pass
            id=re.compile('<input type="hidden" name="id" value="(.+?)">').findall(html)[0]
            fname=re.compile('<input type="hidden" name="fname" value="(.+?)">').findall(html)[0]
            hash=re.compile('<input type="hidden" name="hash" value="(.+?)">').findall(html)[0]
            data={'op':'download1','usr_login':'','id':id,'fname':fname,'referer':'','hash':hash,'imhuman':'Continue+to+Video'}
            html=self.net.http_POST(web_url,data).content
            played=re.compile('file: "(.+?)"').findall(html)[0]
            return played
        except urllib2.URLError, e:
            common.addon.log_error('Played: 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('**** Played Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]PLAYED[/COLOR][/B]',msg='[COLOR red]%s[/COLOR]' % e,delay=5000,image=error_logo)
            return self.unresolvable(code=0,msg=e)
Example #8
0
class playedResolver(Plugin,UrlResolver,PluginSettings):
    implements=[UrlResolver,PluginSettings]
    name="played"
    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:
            data={}; html=self.net.http_GET(web_url,{'host':'played.to'}).content
            r=re.findall(r'<input type="hidden" name="(.+?)"\s* value="(.*?)"',html)
            for name,value in r: data[name]=value
            data.update({'btn_download':'Continue to Video'})
            html=self.net.http_POST(web_url,data).content
            match=re.search('file: "(.+?)"',html)
            if match: return match.group(1)
            else: return self.unresolvable(code=0,msg='unable to locate video') 
        except urllib2.URLError, e:
            common.addon.log_error('Played: 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('**** Played Error occured: %s'%e)
            common.addon.show_small_popup(title='[B][COLOR white]PLAYED[/COLOR][/B]',msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo)
            return self.unresolvable(code=0,msg=e)
class PromptfileResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "promptfile"

    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
            data = {}
            r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html)
            for name, value in r:
                data[name] = value
            html = self.net.http_POST(web_url, data).content
            html = re.compile(r'clip\s*:\s*\{.*?url\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html)
            if not html:
                raise Exception ('File Not Found or removed')
            stream_url = html.group(1)
            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), 5000, error_logo)
            return self.unresolvable(code=3, msg=e)

        except Exception, e:
            common.addon.log_error('**** Promptfile Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]PROMPTFILE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return self.unresolvable(code=0, msg=e)
Example #10
0
def login_docspt():
      print "Sem cookie. A iniciar login"
      try:
            from t0mm0.common.net import Net
            net=Net()
            #form_d = {'user':username,'passwrd':password,'cookieneverexp':'on','hash_passwrd':token}
            form_d={'user':username,'passwrd':password,'cookielength':-1}
            ref_data = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Content-Type': 'application/x-www-form-urlencoded','Host':'www.docspt.com','Origin': 'http://www.docspt.com', 'Referer': 'http://www.docspt.com/index.php?action=login2','User-Agent':user_agent}
            endlogin=MainURL + 'index.php?action=login2'
            try:
                  logintest= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore')
            except: logintest='Erro'
      except:
            link='Erro'
            logintest='Erro'

      if selfAddon.getSetting('docspt-username')== '':
            ok = mensagemok('docsPT','Necessitas de criar conta em','docsPT.com')
            entrarnovamente(1)
      else:    
            if re.search('<p class="error">A password est',logintest):
                  mensagemok('docsPT','Password incorrecta.')
                  entrarnovamente(1)
            elif re.search('<p class="error">Esse utilizador n',logintest):
                  mensagemok('docsPT','Esse utilizador não existe.')
                  entrarnovamente(1)
            elif re.search(username+'!</li>',logintest):
                  xbmc.executebuiltin("XBMC.Notification(docsPT,Sessão iniciada com sucesso,'500000','')")
                  net.save_cookies(cookies)
                  menu_principal(1)
            
            elif re.search('Erro',logintest) or link=='Erro':
                  opcao= xbmcgui.Dialog().yesno('docsPT', 'Sem acesso à internet.', "", "","Tentar novamente", 'OK')
                  if opcao: menu_principal(0)
                  else: login_docspt()                
Example #11
0
def install_metapack(pack):
	packs = metapacks.list()
	pack_details = packs[pack]
	mc = metacontainers.MetaContainer()
	work_path  = mc.work_path
	cache_path = mc.cache_path
	zip = os.path.join(work_path, pack)

	net = Net()
	cookiejar = ADDON.get_profile()
	cookiejar = os.path.join(cookiejar,'cookies')

	html = net.http_GET(pack_details[0]).content
	net.save_cookies(cookiejar)
	name = re.sub('-', r'\\\\u002D', pack)

	r = '"name": "%s".*?"id": "([^\s]*?)".*?"secure_prefix":"(.*?)",' % name
	r = re.search(r,html)
	pack_url  = 'http://i.minus.com'
	pack_url += r.group(2)
	pack_url += '/d' + r.group(1) + '.zip'

	complete = download_metapack(pack_url, zip, displayname=pack)
	extract_zip(zip, work_path)
	xbmc.sleep(5000)
	copy_meta_contents(work_path, cache_path)
	for table in mc.table_list:
		install = mc._insert_metadata(table)
class PlayedResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "played"
    domains = ["played.to"]

    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, {'host': 'played.to'}).content
        r = re.findall(r'<input type="hidden" name="(.+?)"\s* value="(.*?)"', html)
        data = {}
        for name, value in r: data[name] = value
        data.update({'btn_download': 'Continue to Video'})
        html = self.net.http_POST(web_url, data).content
        match = re.search('file: "(.+?)"', html)
        if match: return match.group(1)
        else: raise UrlResolver.ResolverError('unable to locate video')

    def get_url(self, host, media_id):
            return 'http://played.to/%s' % (media_id)
    
    def get_host_and_id(self, url):
        r = re.match(r'http://(?:www.)?(played).to/(?:embed-)?([0-9a-zA-Z]+)', 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(r'http://(?:www.)?(played).to/(?:embed-)?([0-9a-zA-Z]+)', url) or 'played' in host
Example #13
0
class Mp4EdgeResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mp4edge.com"
    domains = ["mp4edge.com"]
    
    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:.*?)mp4edge\.com)/stream/([0-9a-zA-Z]+)'
        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/stream/%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 host in self.domains
    
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        html = self.net.http_GET(web_url, headers=self.headers).content
        r = re.search('file\s*:\s*["\'](.+?)["\']', html)
        if r:
            return r.group(1)
        else:
            raise UrlResolver.ResolverError('File not found')
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
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
class AllVidResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "allvid"
    domains = ["allvid.ch"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://(allvid\.ch)/(?:embed-)(.+?)(?:-|/|\.|$)'
        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.html' % (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.match(self.pattern, url) or host in self.domains

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        html = self.net.http_GET(web_url, headers=self.headers).content
        r = re.search('sources\s*:\s*\[\s*\{\s*file\s*:\s*["\'](.+?)["\']', html)
        if r:
            return r.group(1)
        else:
            raise UrlResolver.ResolverError('File not found')
Example #17
0
def getListOfMyAccount(url, pagina):
    net = Net()
    net.set_cookies(__COOKIE_FILE__)
    codigo_fonte = net.http_GET(url, headers=__HEADERS__).content
    

    match = re.compile('<div id="5" class="item">\s+<a href="(.+?)">\s+<img src="(.+?)" alt="(.+?)" title="(.+?)">').findall(codigo_fonte)

    if 'favoritos.php' in url:
        tipo = 'kodi_favoritos'
    elif 'agendados.php' in url:
        tipo = 'agendados'
    elif 'vistos.php' in url:
        tipo = 'vistos'

    pprint.pprint(match) 

    for link, imagem, nome, nome1 in match:
        if 'filme.php' in link:
            infoLabels = {'Title': nome.encode('utf8') }
            addVideo(nome.encode('utf8'), __SITE__+"kodi_"+link, 3, imagem, 'filme', 0, 0, infoLabels, imagem)
        elif 'serie.php' in link:
            infoLabels = {'Title': nome.encode('utf8')}
            addDir(nome.encode('utf8'), __SITE__+"kodi_"+link, 4, imagem, pagina, 'serie', infoLabels, imagem)
    
    
    addDir('Proximo', __SITE__+tipo+'.php?pagina='+str(int(pagina)+1), 11, os.path.join(__ART_FOLDER__, __SKIN__, 'proximo.png'), int(pagina)+1)

    vista_filmesSeries()
class bayfilesResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "bayfiles"

    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)
        return final_link.group(1)
       
    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):
        if self.get_setting('enabled') == 'false': return False
        return (re.match(r'http://(bayfiles).com/file/uMXL/([a-zA-Z0-9._/]+)', url) or 'bayfiles' in host)
Example #19
0
def download(url,name):

    legendasOn = False

    if 'serie.php' in url:
        siteBase = 'serie.php'
    elif 'filme.php' in url:
        siteBase = 'filme.php'

    net = Net()
    net.set_cookies(__COOKIE_FILE__)
    codigo_fonte = net.http_GET(url, headers=__HEADERS__).content

    match = re.compile('<a class="btn" href="(.+?)"><img src="(.+?)"><\/a>').findall(codigo_fonte)

    stream, legenda = getStreamLegenda(match, siteBase, codigo_fonte)


    folder = xbmc.translatePath(__ADDON__.getSetting('pastaDownloads'))
    
    streamAux = clean(stream.split('/')[-1])
    extensaoStream = clean(streamAux.split('.')[1])
    name = name+'.'+extensaoStream


    if legenda != '':
        legendaAux = clean(legenda.split('/')[-1])
        extensaoLegenda = clean(legendaAux.split('.')[1])
        nomeLegenda = name+'.'+extensaoLegenda
        legendasOn = True

    Downloader.Downloader().download( os.path.join(folder,name), stream, name)

    if legendasOn:
        download_legendas(legenda, os.path.join(folder,nomeLegenda))
Example #20
0
def getEpisodes(url):

    net = Net()
    net.set_cookies(__COOKIE_FILE__)
    codigo_fonte = net.http_GET(url, headers=__HEADERS__).content


    match = re.compile('<div id="(.+?)" class="item">\s+<div class="thumb(.+?)?">\s+<a name=\'.+?\' href="(.+?)">\s+<img style="(.+?)" src="(.+?)" onError="this\.onerror=null;this\.src=\'(.+?)\';"\s+alt="(.+?)?">\s+<div class="thumb-shadow" alt="(.+?)?"><\/div>\s+<div class="thumb-effect" alt="(.+?)?"><\/div>\s+<div class="episode-number">(.+?)<\/div>').findall(codigo_fonte)

    temporadaNumero = re.compile('<div\s+class="season"><a\s+href="(.+?)"\s+class="slctd">(.+?)<\/a>').findall(codigo_fonte)[0][1]
    #actors = re.compile('<span class="director-caption">Elenco:<\/span>\s+<span class="director">(.+?)<\/span>').findall(codigo_fonte)[0]
    try:
        plot = re.compile(u'Descrição:<\/span>(.+\s.+)<\/span>\s+<\/div>').findall(codigo_fonte)[0]
    except:
        plot = "-"

    #criador = re.compile('<span class="director-caption">Criador: <\/span>\s+<span class="director">\s+(.+?)<\/span>').findall(codigo_fonte)[0]
    serieTitulo = re.compile('<span class="original-name">- "(.+?)"<\/span>').findall(codigo_fonte)[0].encode('utf8')

    for lixo, lixo1, link, lixo2, imagem, imagemExterna, nome, nome1, nome2, episodioNumero in match:
        imdb = re.compile('imdb=(.+?)&').findall(link)[0]
        #infoLabels = {'Title':nome.decode('utf8'), 'Actors':actors.decode('utf8'), 'Plot':plot.decode('utf8'), 'Season':temporadaNumero, 'Episode':episodioNumero, 'Writer': criador.decode('utf8'), "Code":imdb }
        infoLabels = {'Title': nome.decode('utf8'), 'Season':temporadaNumero, 'Episode': episodioNumero, "Code": imdb}
        if 'e' in episodioNumero:
            episodioNumeroReal = re.compile('(.+)e').findall(episodioNumero)[0]
        else:
            episodioNumeroReal = episodioNumero

        addVideo('[B]Episodio '+episodioNumero+'[/B] | '+nome.encode('utf8'), __SITE__+"kodi_"+link, 3, __SITE__+imagem, 'episodio', temporadaNumero, episodioNumeroReal, infoLabels, imagemExterna, serieTitulo)

    vista_episodios()
class PutlockerResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "putlocker/sockshare/filedrive/firedrive"
    profile_path = common.profile_path
    cookie_file = os.path.join(profile_path, 'putlocker.cookies')

    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):
        if self.get_setting('login') == 'true':
            if self.login_stale():
                self.login()
        self.net.set_cookies(self.cookie_file)
        web_url = self.get_url(host, media_id)
        if web_url[-1:1]=="#": web_url.replace("#",""); 

        #find session_hash
        try:
            html = self.net.http_GET(web_url).content
            if "404: This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": 404: This file might have been moved, replaced or deleted.") #firedrive error
            elif ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") #sockshare error
            #Shortcut for logged in users
            pattern = '<a href="(/.+?)" class="download_file_link" style="margin:0px 0px;">Download File</a>'
            link = re.search(pattern, html)
            if link:
                common.addon.log('Direct link found: %s' % link.group(1))
                if 'putlocker' in host:
                    return 'http://www.filedrive.com%s' % link.group(1)
                    #return 'http://www.putlocker.com%s' % link.group(1)
                elif 'filedrive' in host:
                    return 'http://www.filedrive.com%s' % link.group(1)
                elif 'firedrive' in host:
                    return 'http://www.firedrive.com%s' % link.group(1)

            if 'firedrive' in host or 'filedrive' in host or 'putlocker' in host or 'sockshare' in host:
                try:
                	data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); #data['usr_login']=''
                	for name, value in r: data[name] = value
                	#data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video'
                	#xbmc.sleep(2000)
                	html = self.net.http_POST(web_url, data).content
                except urllib2.URLError, e:
                    common.addon.log_error(host+': got http error %d fetching 2nd url %s' % (e.code, web_url))
                    return self.unresolvable(code=3, msg='Exception: %s' % e) #return False
                r = re.search('<a href="(.+?)" id=\'external_download\' title=\'Download This File\'>', html)
                if r:
                    return urllib.unquote_plus(r.group(1))
                #else:
                #    common.addon.log_error(host+': stream url not found')
                #    return self.unresolvable(code=0, msg='no file located') #return False
                r = re.search("$.post('(.+?)', function(data) {", html)
                if r:
                    return urllib.unquote_plus(r.group(1))
                else:
                    common.addon.log_error(host+': stream url not found')
                    return self.unresolvable(code=0, msg='no file located') #return False
            else:
class CyberlockerResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "cyberlocker"
    domains = ["cyberlocker.ch"]

    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
        r = re.findall('<center><h3>File Not Found</h3></center><br>', html, re.I)
        if r:
            raise UrlResolver.ResolverError('File Not Found or removed')
        if not r:
            data = {}
            r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html)
            for name, value in r:
                data[name] = value
                data['method_free'] = 'Wait for 0 seconds'
            
        html = self.net.http_POST(url, data).content
        
        sPattern = '<script type=(?:"|\')text/javascript(?:"|\')>(eval\('
        sPattern += 'function\(p,a,c,k,e,d\)(?!.+player_ads.+).+np_vid.+?)'
        sPattern += '\s+?</script>'
        r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
        if r:
            sJavascript = r.group(1)
            sUnpacked = jsunpack.unpack(sJavascript)
            sPattern = '<embed id="np_vid"type="video/divx"src="(.+?)'
            sPattern += '"custommode='
            r = re.search(sPattern, sUnpacked)
            if r:
                return r.group(1)
        else:
            num = re.compile('cyberlocker\|(.+?)\|http').findall(html)
            pre = 'http://'+num[0]+'.cyberlocker.ch:182/d/'
            preb = re.compile('image\|(.+?)\|video\|(.+?)\|').findall(html)
            for ext, link in preb:
                r = pre+link+'/video.'+ext
                return r

    def get_url(self, host, media_id):
        return 'http://cyberlocker.ch/%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):
        return (re.match('http://(www.)?cyberlocker.ch/' +
                         '[0-9A-Za-z]+', url) or
                         'cyberlocker' in host)
class UfliqResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "ufliq"

    def __init__(self):
        p = self.get_setting("priority") or 100
        self.priority = int(p)
        self.net = Net()
        # e.g. http://www.ufliq.com/embed-rw52re7f5aul.html
        self.pattern = "http://((?:www.)?ufliq.com)/(?:embed-)?([0-9a-zA-Z]+)"

    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()
            print post_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

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

        r = re.search("url: '(.+?)', autoPlay: false,onBeforeFinish:", html)
        if r:
            return r.group(1)

        return False
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)
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)
Example #26
0
def PostContent(formvar, url):
    try:
        net = Net()
        headers = {}
        headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
        headers["Accept-Encoding"] = "gzip, deflate"
        headers["Accept-Charset"] = "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
        headers["Referer"] = "http://www.khmeraccess.com/video/videolist/videonew.html?cid=1"
        headers["Content-Type"] = "application/x-www-form-urlencoded"
        headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1"
        headers["Connection"] = "keep-alive"
        headers["Host"] = "www.khmeraccess.com"
        headers["Accept-Language"] = "en-us,en;q=0.5"
        headers["Pragma"] = "no-cache"
        formdata = {}
        formdata["start"] = formvar

        # first_response = net.http_Get('http://khmerfever.com/wp-login.php',headers=header_dict)
        # net.save_cookies('c:\cookies.txt')
        # net.set_cookies('c:\cookies.txt')
        second_response = net.http_POST(url, formdata, headers=headers, compression=False)
        return second_response.content
    except:
        d = xbmcgui.Dialog()
        d.ok("Time out", "Can't Connect to site", "Try again in a moment")
class CloudyvideosResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "cloudyvideos"

    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           
            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
            r = re.search("file: '([^']+)'",html)
            if not r:
                raise Exception ('Unable to resolve cloudyvideos link. Filelink not found.')
            return r.group(1)
        
        except urllib2.URLError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' %
                                    (e.code, web_url))
            return self.unresolvable(code=3, msg='Exception: %s' % e) 
        except Exception, e:
            common.addon.log('**** cloudyvideos 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')
class SharedsxResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "sharedsx"
    domains = ["shared.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)
        # get landing page
        html = self.net.http_GET(web_url, headers={'Referer': web_url}).content
        
        # read POST variables into data
        data = {}
        r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html)
        if not r: raise UrlResolver.ResolverError('page structure changed')
        for name, value in r: data[name] = value
        
        # get delay from hoster; actually this is not needed, but we are polite
        delay = 5
        r = re.search(r'var RequestWaiting = (\d+);', html)
        if r: delay = r.groups(1)[0]
        
        # run countdown and check whether it was canceld or not
        cnt = common.addon.show_countdown(int(delay), title='shared.sx', text='Please wait for hoster...')
        if not cnt: raise UrlResolver.ResolverError('countdown was canceld by user')
        
        # get video page using POST variables
        html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content
        
        # search for content tag
        r = re.search(r'class="stream-content" data-url', html)
        if not r: raise UrlResolver.ResolverError('page structure changed')
        
        # read the data-url
        r = re.findall(r'data-url="?(.+?)"', html)
        if not r: raise UrlResolver.ResolverError('video not found')
        
        # return media URL
        return r[0]
    
    def get_url(self, host, media_id):
        return 'http://shared.sx/%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.)?shared.sx/' +
                         '[0-9A-Za-z]+', url) or
                         'shared.sx' in host)
Example #30
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
Example #31
0
class get_stream_link:
    def __init__(self):
        #self._callback = None
        self.net = Net()

    def get_stream(self, link):
        hoster = self.get_hostername(link)
        if hoster == 'putlocker':
            return self.streamPutlockerSockshare(link, 'putlocker')
        elif hoster == 'sockshare':
            return self.streamPutlockerSockshare(link, 'sockshare')
        elif hoster == 'youtube':
            return self.youtube(link)
        elif hoster == 'videoslasher':
            return self.videoslaher(link)
        elif hoster == 'faststream':
            return self.generic1(link, 'Faststream', 10, 0)
        elif hoster == 'flashx':
            return self.generic1(link, 'Flashx', 4, 0)
        elif hoster == 'vk':
            return self.vk(link)
        elif hoster == 'streamcloud':
            return self.streamcloud(link)
        elif hoster == 'vidstream':
            return self.vidstream(link)
        elif hoster == 'xvidstage':
            return self.xvidstage(link)
        elif hoster == 'videoweed':
            return self.videoweed(link)
        elif hoster == 'nowvideo':
            return self.generic2(link)
        elif hoster == 'movshare':
            return self.generic2(link)
        elif hoster == 'divxstage':
            return self.generic2(link)
        elif hoster == 'novamov':
            return self.generic2(link)
        elif hoster == 'primeshare':
            return self.primeshare(link)
        elif hoster == 'videomega':
            return self.videomega(link)
        elif hoster == 'bitshare':
            return self.bitshare(link)
        elif hoster == 'movreel':
            return self.movreel(link)
        elif hoster == 'uploadc':
            return self.uploadc(link)
        elif hoster == 'youwatch':
            return self.youwatch(link)
        elif hoster == 'yandex':
            return self.generic1(link, 'Yandex', 0, 0)
        elif hoster == 'vidx':
            return self.generic1(link, 'ViDX', 10, 0)
        elif hoster == 'K1no HD':
            return link
        elif hoster == 'sharedsx':
            return self.generic1(link, 'Shared.sx', 0, 1)
        elif hoster == 'vivosx':
            return self.generic1(link, 'Vivo.sx', 0, 1)
        elif hoster == 'cloudyvideos':
            return self.generic1(link, 'CloudyVideos', 2, 2)
        return 'Not Supported'

    def getUrl(self, url):
        req = urllib2.Request(url)
        req.add_header(
            'User-Agent',
            'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
        )
        response = urllib2.urlopen(req)
        data = response.read()
        response.close()
        return data

    def get_adfly_link(self, adflink):
        print 'resolving adfly url: \'%s\' using http://dead.comuv.com/bypasser/process.php' % (
            adflink)
        data = self.net.http_POST('http://dead.comuv.com/bypasser/process.php',
                                  {
                                      'url': adflink
                                  }, {
                                      'Referer': 'http://dead.comuv.com/',
                                      'X-Requested-With': 'XMLHttpRequest'
                                  }).content
        link = re.findall('<a[^>]*href="([^"]*)"', data,
                          re.S | re.I | re.DOTALL)
        if link: return link[0]
        else: return 'empty'

    def get_adfly_link_2(self, adflink):
        print 'resolving adfly url: \'%s\' using http://cyberflux.info/shortlink.php' % (
            adflink)
        data = self.net.http_POST(
            'http://cyberflux.info/shortlink.php', {
                'urllist': adflink
            }, {
                'Referer': 'http://cyberflux.info/shortlink.php'
            }).content
        link = re.findall(adflink + '[ ]*=[ ]*<a[^>]*href=([^>]*)>', data,
                          re.S | re.I | re.DOTALL)
        if link: return link[0]
        else: return 'empty'

    def waitmsg(self, sec, msg):
        isec = int(sec)
        if isec > 0:
            dialog = xbmcgui.DialogProgress()
            dialog.create('Resolving', '%s Link.. Wait %s sec.' % (msg, sec))
            dialog.update(0)
            c = 100 / isec
            i = 1
            p = 0
            while i < isec + 1:
                p += int(c)
                time.sleep(1)
                dialog.update(int(p))
                i += 1
            dialog.close()

    def get_hostername(self, link):
        if link:
            for (hoster, urlrex) in hosterlist:
                if re.match(urlrex, link, re.S | re.I): return hoster
        return 'Not Supported'

    def get_stream_url(self, sUnpacked):
        if not sUnpacked: return
        stream_url = re.findall('type="video/divx"src="(.*?)"', sUnpacked,
                                re.S | re.I | re.DOTALL)
        if not stream_url:
            stream_url = re.findall("file','(.*?)'", sUnpacked,
                                    re.S | re.I | re.DOTALL)
        if not stream_url:
            stream_url = re.findall('file:"(.*?)"', sUnpacked,
                                    re.S | re.I | re.DOTALL)
        if stream_url: return stream_url[0]

    def youtube(self, url, videoPrio=2):
        # this part is from mtube plugin
        print "got url: " + str(url)
        if videoPrio == 0:
            VIDEO_FMT_PRIORITY_MAP = {
                '38': 6,  #MP4 Original (HD)
                '37': 5,  #MP4 1080p (HD)
                '22': 4,  #MP4 720p (HD)
                '35': 2,  #FLV 480p
                '18': 1,  #MP4 360p
                '34': 3,  #FLV 360p
            }
        elif videoPrio == 1:
            VIDEO_FMT_PRIORITY_MAP = {
                '38': 6,  #MP4 Original (HD)
                '37': 5,  #MP4 1080p (HD)
                '22': 1,  #MP4 720p (HD)
                '35': 3,  #FLV 480p
                '18': 2,  #MP4 360p
                '34': 4,  #FLV 360p
            }
        else:
            VIDEO_FMT_PRIORITY_MAP = {
                '38': 3,  #MP4 Original (HD)
                '37': 1,  #MP4 1080p (HD)
                '22': 2,  #MP4 720p (HD)
                '35': 5,  #FLV 480p
                '18': 4,  #MP4 360p
                '34': 6,  #FLV 360p
            }
        video_url = None
        url = url.replace('/embed/', '/watch?v=')
        id = re.findall('watch.v=(.*\D)', url, re.S)
        video_id = id[0]
        # Getting video webpage
        #URLs for YouTube video pages will change from the format http://www.youtube.com/watch?v=ylLzyHk54Z0 to http://www.youtube.com/watch#!v=ylLzyHk54Z0.
        watch_url = 'http://www.youtube.com/watch?v=%s&gl=DE&hl=de' % video_id
        watchrequest = Request(watch_url, None, std_headers)
        try:
            print "[youtubeUrl] trying to find out if a HD Stream is available", watch_url
            watchvideopage = urlopen2(watchrequest).read()
        except (URLError, HTTPException, socket.error), err:
            return "Error: Unable to retrieve watchpage - Error code: %s" % str(
                err)
            # Get video info
        for el in ['&el=embedded', '&el=detailpage', '&el=vevo', '']:
            info_url = (
                'http://www.youtube.com/get_video_info?&video_id=%s%s&ps=default&eurl=&gl=DE&hl=de'
                % (video_id, el))
            request = Request(info_url, None, std_headers)
            try:
                infopage = urlopen2(request).read()
                videoinfo = parse_qs(infopage)
                if ('url_encoded_fmt_stream_map'
                        or 'fmt_url_map') in videoinfo:
                    break
            except (URLError, HTTPException, socket.error), err:
                return "Error: unable to download video infopage - %s" % str(
                    err)
Example #32
0
class VideozerResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "videozer"

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

    def get_media_url(self, host, media_id):

        #grab url for this video
        settings_url = "http://www.videozer.com/" + \
            "player_control/settings.php?v=%s" % media_id

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

        #find highest quality URL
        max_res = [240, 480, 99999][int(self.get_setting('q'))]
        r = re.finditer('"l".*?:.*?"(.+?)".+?"u".*?:.*?"(.+?)"', html)
        chosen_res = 0
        stream_url = False

        if r:
            for match in r:
                res, url = match.groups()
                if (res == 'LQ'): res = 240
                elif (res == 'SD'): res = 480
                else: res = 720
                if res > chosen_res and res <= max_res:
                    stream_url_part1 = url.decode('base-64')
                    chosen_res = res
        else:
            common.addon.log_error('videozer: stream url part1 not found')
            return False

        # Try to load the datas from html. This data should be json styled.
        aData = loads(html)

        # Decode the link from the json data settings.
        spn_ik = unhexlify(
            self.__decrypt(aData["cfg"]["login"]["spen"],
                           aData["cfg"]["login"]["salt"], 950569)).split(';')
        spn = spn_ik[0].split('&')
        ik = spn_ik[1]

        for item in ik.split('&'):
            temp = item.split('=')
            if temp[0] == 'ik':
                key = self.__getKey(temp[1])

        sLink = ""
        for item in spn:
            item = item.split('=')
            if (int(item[1]) == 1):
                sLink = sLink + item[0] + '=' + self.__decrypt(
                    aData["cfg"]["info"]["sece2"],
                    aData["cfg"]["environment"]["rkts"],
                    key) + '&'  #decrypt32byte
            elif (int(item[1] == 2)):
                sLink = sLink + item[0] + '=' + self.__decrypt(
                    aData["cfg"]["ads"]["g_ads"]["url"],
                    aData["cfg"]["environment"]["rkts"], key) + '&'
            elif (int(item[1]) == 3):
                sLink = sLink + item[0] + '=' + self.__decrypt(
                    aData["cfg"]["ads"]["g_ads"]["type"],
                    aData["cfg"]["environment"]["rkts"], key, 26, 25431, 56989,
                    93, 32589, 784152) + '&'
            elif (int(item[1]) == 4):
                sLink = sLink + item[0] + '=' + self.__decrypt(
                    aData["cfg"]["ads"]["g_ads"]["time"],
                    aData["cfg"]["environment"]["rkts"], key, 82, 84669, 48779,
                    32, 65598, 115498) + '&'
            elif (int(item[1]) == 5):
                sLink = sLink + item[0] + '=' + self.__decrypt(
                    aData["cfg"]["login"]["euno"],
                    aData["cfg"]["login"]["pepper"], key, 10, 12254, 95369, 39,
                    21544, 545555) + '&'
            elif (int(item[1]) == 6):
                sLink = sLink + item[0] + '=' + self.__decrypt(
                    aData["cfg"]["login"]["sugar"],
                    aData["cfg"]["ads"]["lightbox2"]["time"], key, 22, 66595,
                    17447, 52, 66852, 400595) + '&'

        sLink = sLink + "start=0"

        sMediaLink = stream_url_part1 + '&' + sLink

        return sMediaLink
Example #33
0
 def __init__(self):
     #self._callback = None
     self.net = Net()
 def __init__(self):
     p = self.get_setting('priority') or 100
     self.priority = int(p)
     self.net = Net()
     #e.g. http://gorillavid.com/vb80o1esx2eb
     self.pattern = 'http://((?:www.)?gorillavid.in)/([0-9a-zA-Z]+)'
Example #35
0
 def __init__(self):
     p = self.get_setting('priority') or 100
     self.priority = int(p)
     self.net = Net()
     self.pattern = 'http://((?:www.)?videozer.com)/(?:embed|video)?/([0-9a-zA-Z]+)'