Beispiel #1
0
def getSources(url):
    sources = []
    try:
        html = http_req(url)

        quality = ''
        if(re.search('filme', url)):
            quality = re.search(r'Calitate film: nota <b>(.+?)</b>', html)
        
        match = re.search(r"<a class='link' href='(player.+?sfast.+?html?)'", html)
        
        url = urlFilter(match.group(1))
        html = http_req(url)
        
        m = re.search(r"<div class='player.+?'", html, re.DOTALL)
        x, y = m.span()

        html = html[x:]
        playerdiv = ''

        i = 0
        for line in html.splitlines():
            playerdiv += line.strip()
            m = re.findall(r'<div', line)
            n = re.findall(r'<\/div>', line)
            i += len(m)
            i -= len(n)
            if i == 0:
                break

        s = re.search(r"<a href='(http:\/\/(?:www\.)?.+?)'>", playerdiv).group(1)

        url = s[s.rfind('http'):]
        html = http_req(url)
        
        match = re.search(r"'file'\s*:\s*'(.+?)',", html)
        videoLink = match.group(1) + '|referer=' + url
        
        subtitle = ''
        if plugin.getSetting("enableSub") == 'true':
            html = ''.join(line.strip() for line in html.split('\n'))
            match = re.search(r"'tracks':\s?\[\{\s?'file':\s?\"(.+?)\",\s?'label':", html)
            if match:
                subtitle = saveSubtitle(match.group(1))

        if(quality == ''):
            item = {'name': 'Play Video', 'url': videoLink, 'subtitle': subtitle}
        else:
            item = {'name': 'Play Video (Quality:'+quality.group(1)+')', 'url': videoLink, 'subtitle': subtitle}

        sources.append(item)

        return sources
    except:
        return False
Beispiel #2
0
def getSubtitle(url):
	subtitle = ''
	try:
		if plugin.getSetting("enableSub") == 'true':
			page = str(BeautifulSoup(http_req(url)).findAll("script"))
			page = ''.join(page.split())
			match = re.findall('\'tracks\':\[{\'file\':"http:\/\/superweb\.rol\.ro\/video\/jw6\/(.+?)",', page)
			if match:
				sub_url = 'http://superweb.rol.ro/video/jw6/' + match[0]
				sub_tmp = os.path.join(xbmc.translatePath("special://temp"), match[0])
				with open(sub_tmp, 'w') as f:
					f.write(http_req(sub_url))
				subtitle = match[0]
	except: pass
	return subtitle
Beispiel #3
0
def getSources(url):
    sources = []
    try:
        html = http_req(url)

        quality = ""
        if re.search("filme", url):
            quality = re.search(r"Calitate film: nota <b>(.+?)</b>", html)

        match = re.search(r"<a class='link' href='(player.+?sfast.+?html?)'", html)

        url = urlFilter(match.group(1))
        html = http_req(url)

        playerdiv = re.search(r"<div class='player.+?</div>", html, re.DOTALL).group(0)
        a = re.search(r"<a href='(http:\/\/(?:www\.)?.+?)'>", playerdiv).group(1)

        url = a[a.rfind("http") :]
        html = http_req(url)

        match = re.search(r"'file'\s*:\s*'(.+?)',", html)
        videoLink = match.group(1) + "|referer=" + url

        subtitle = ""
        if plugin.getSetting("enableSub") == "true":
            match = re.search(r"'captions\.file'\s*:\s*'(.+?)',", html)
            if match:
                subtitle = saveSubtitle(match.group(1))

        if quality == "":
            item = {"name": "Play Video", "url": videoLink, "subtitle": subtitle}
        else:
            item = {"name": "Play Video (Quality:" + quality.group(1) + ")", "url": videoLink, "subtitle": subtitle}

        sources.append(item)

        return sources
    except:
        return False
Beispiel #4
0
def getEpisodes(url,season,title,thumbnail):
	progress = xbmcgui.DialogProgress()
	progress.create('Progress', 'Please wait...')
	progress.update(1, "", "Loading list - 1%", "")

	title = re.sub('\(.+?\)', '', title).strip()
	
	list = []
	
	cache = False
	if plugin.getSetting("enableCache") == 'true':
		cacheFilename = '%s-s%s-episodes' % (re.sub(' ', '-', title), season)
		cache = plugin.cacheLoad(cacheFilename, int(plugin.getSetting("cacheExpire")))
		if cache:
			list = cache

	if not cache:		
		div = htmlFilter(str(BeautifulSoup(http_req(url)).find("div", {"id": "content"})), True)
		
		episodes = re.findall(r'Sezonul '+season+', Episodul (.+?)</div>.+?<a href="(seriale.+?html?)" class="link">(.+?)</a>', div)
		
		if episodes:
			total = len(episodes)
		else:
			episodes = re.findall(r'ma;">([\d]+)</div>.+?<a href="(seriale.+?html?)" class="link">(.+?)</a>', div)
			total = len(episodes)

		current = 0

		while current <= total - 1:
			ep_name = episodes[current][2]
			if ep_name == str(re.findall('(Episodul [-0-9]*)',ep_name)).strip('[]').strip('"\''): ep_name = ''
			
			tvshow = {}
			tvshow['url'] = urlFilter(episodes[current][1])
			tvshow['thumbnail'] = thumbnail
			tvshow['title'] = title
			tvshow['season'] = season
			tvshow['ep_num'] = episodes[current][0]
			tvshow['ep_name'] = ep_name
			list.append(tvshow)
			
			if progress.iscanceled(): sys.exit()
			
			percent = int(((current + 1) * 100) / total)
			message = "Loading list - " + str(percent) + "%"
			progress.update(percent, "Enabling cache storage will speed up future loads.", message, "")
			
			current += 1
			
		if plugin.getSetting("enableCache") == 'true':
			plugin.cacheList(list, cacheFilename)
	
	for tvshow in list:
		name = '%sx%s %s' % (season, tvshow['ep_num'], tvshow['ep_name'])
		
		addDir(name,tvshow['url'],8,tvshow['thumbnail'],tvshow['title'],tvshow['season'],tvshow['ep_num'],tvshow['ep_name'],folder=False)
		
	progress.close()

	xbmcplugin.endOfDirectory(int(sys.argv[1]))
Beispiel #5
0
def getEpisodes(url,season,title,thumbnail):
	progress = xbmcgui.DialogProgress()
	progress.create('Progress', 'Please wait...')
	progress.update(1, "", "Loading list - 1%", "")

	title = re.sub('\(.+?\)', '', title).strip()
	
	list = []
	
	cache = False
	if plugin.getSetting("enableCache") == 'true':
		cacheFilename = '%s-s%s-episodes' % (re.sub(' ', '-', title), season)
		cache = plugin.cacheLoad(cacheFilename, int(plugin.getSetting("cacheExpire")))
		if cache:
			list = cache

	if not cache:		
		div = htmlFilter(str(BeautifulSoup(http_req(url)).find("div", {"id": "content"})), True)
		
		episodes = re.findall(r'Sezonul '+season+', Episodul (.+?)</div>.+?<a href="seriale2-([\d]+-[\d]+)-.+?.html" class="link">(.+?)</a>', div)

		if episodes:
			total = len(episodes)
		else:
			episodes = re.findall(r'ma;">([\d]+)</div>.+?<a href="seriale2-([0-9]+-[0-9]+)-.+?.html" class="link">(.+?)</a>', div)
			total = len(episodes)

		current = 0

		while current <= total - 1:
			
			ep_num = episodes[current][0]
			ep_name = episodes[current][2]
			
			if ep_name == str(re.findall('(Episodul [-0-9]*)',ep_name)).strip('[]').strip('"\''): ep_name = ''
			
			tvshow = {}
			tvshow['url'] = siteUrl + 'player-serial-' + episodes[current][1] + '-sfast.html'
			tvshow['thumbnail'] = thumbnail
			tvshow['title'] = title
			tvshow['season'] = season
			tvshow['ep_num'] = ep_num
			tvshow['ep_name'] = ep_name
			list.append(tvshow)
			
			if progress.iscanceled(): sys.exit()
			
			percent = int(((current + 1) * 100) / total)
			message = "Loading list - " + str(percent) + "%"
			progress.update(percent, "Enabling cache storage will speed up future loads.", message, "")
			
			current += 1
			
		if plugin.getSetting("enableCache") == 'true':
			plugin.cacheList(list, cacheFilename)

	for tvshow in list:
		name = 'Episode %s %s' % (tvshow['ep_num'], tvshow['ep_name'])
		
		addDir(name,tvshow['url'],8,tvshow['thumbnail'],tvshow['title'],tvshow['season'],tvshow['ep_num'],tvshow['ep_name'],folder=False)
		
	progress.close()

	xbmcplugin.endOfDirectory(int(sys.argv[1]))
Beispiel #6
0
def getSources(url):
    sources = []
    try:
        html = http_req(url)

        quality = ''
        if (re.search('filme', url)):
            quality = re.search(r'Calitate film: nota <b>(.+?)</b>', html)

        match = re.search(r"<a class='link' href='(player.+?sfast.+?html?)'",
                          html)

        url = urlFilter(match.group(1))
        html = http_req(url)

        m = re.search(r"<div class='player.+?'", html, re.DOTALL)
        x, y = m.span()

        html = html[x:]
        playerdiv = ''

        i = 0
        for line in html.splitlines():
            playerdiv += line.strip()
            m = re.findall(r'<div', line)
            n = re.findall(r'<\/div>', line)
            i += len(m)
            i -= len(n)
            if i == 0:
                break

        s = re.search(r"<a href='(http:\/\/(?:www\.)?.+?)'>",
                      playerdiv).group(1)

        url = s[s.rfind('http'):]
        html = http_req(url)

        match = re.search(r"'file'\s*:\s*'(.+?)',", html)
        videoLink = match.group(1) + '|referer=' + url

        subtitle = ''
        if plugin.getSetting("enableSub") == 'true':
            html = ''.join(line.strip() for line in html.split('\n'))
            match = re.search(
                r"'tracks':\s?\[\{\s?'file':\s?\"(.+?)\",\s?'label':", html)
            if match:
                subtitle = saveSubtitle(match.group(1))

        if (quality == ''):
            item = {
                'name': 'Play Video',
                'url': videoLink,
                'subtitle': subtitle
            }
        else:
            item = {
                'name': 'Play Video (Quality:' + quality.group(1) + ')',
                'url': videoLink,
                'subtitle': subtitle
            }

        sources.append(item)

        return sources
    except:
        return False