Exemplo n.º 1
0
 def __init__(self):
     #self._callback = None
     self.net = Net()
Exemplo n.º 2
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)
Exemplo n.º 3
0
	def __init__(self):
		#self._callback = None
		self.net = Net()
Exemplo n.º 4
0
from httplib import HTTPConnection, CannotSendRequest, BadStatusLine, HTTPException
from socket import gaierror, error
from resources.common.net import Net
from jsunpacker import cJsUnpacker

COOKIEFILE = xbmc.translatePath('special://temp/dabdate_cookie.lwp')

cj = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
if os.path.isfile(COOKIEFILE):
    cj.load(COOKIEFILE)
    xbmc.log("Cookie is loaded", xbmc.LOGINFO)
xbmc.log("Cookie is set, " + COOKIEFILE, xbmc.LOGINFO)

net = Net()

hosterlist = [
    ('youtube', '.*www\.youtube\.com'),
    ('putlocker', '.*www\.putlocker\.com/(?:file|embed)/'),
    ('sockshare', '.*www\.sockshare\.com/(?:file|embed)/'),
    ('videoslasher', '.*www\.videoslasher\.com/embed/'),
    ('faststream', '.*faststream\.in'),
    ('flashx', '.*flashx\.tv'),
    ('vk', '.*vk\.(me|com)/'),
    ('streamcloud', '.*streamcloud\.eu'),
    ('vidstream', '.*vidstream\.in'),
    ('xvidstage', '.*xvidstage\.com'),
    ('nowvideo', '.*nowvideo\.(?:eu|sx)'),
    ('movshare', '.*movshare\.net'),
    ('divxstage', '.*(?:embed\.divxstage\.eu|divxstage\.eu/video)'),
Exemplo n.º 5
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)