Exemplo n.º 1
0
 def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
     try:
         url = self.__search([tvshowtitle, localtvshowtitle, tvmaze.tvMaze().showLookup('thetvdb', tvdb).get(
             'name')] + source_utils.aliases_to_array(aliases), year)
         return urllib.urlencode({'url': url}) if url else None
     except:
         return
Exemplo n.º 2
0
	def episode(self, url, imdb, tvdb, title, premiered, season, episode):
		try:
			if not url:
				return
			return urllib.urlencode(
				{'url': url, 'episode': tvmaze.tvMaze().episodeAbsoluteNumber(tvdb, int(season), int(episode))})
		except:
			return
Exemplo n.º 3
0
	def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
		try:
			url = self.__search([localtvshowtitle] + source_utils.aliases_to_array(aliases), year)
			if not url and tvshowtitle != localtvshowtitle: url = self.__search(
				[tvshowtitle] + source_utils.aliases_to_array(aliases), year)
			if not url: url = self.__search(tvmaze.tvMaze().getTVShowTranslation(tvdb, 'el'), year)
			return url
		except:
			return
Exemplo n.º 4
0
	def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
		try:
			url = self.__search([localtvshowtitle] + source_utils.aliases_to_array(aliases), year)
			if not url and tvshowtitle != localtvshowtitle: url = self.__search(
				[tvshowtitle] + source_utils.aliases_to_array(aliases), year)
			if not url and source_utils.is_anime('show', 'tvdb', tvdb): url = self.__search(
				[tvmaze.tvMaze().showLookup('thetvdb', tvdb).get('name')] + source_utils.aliases_to_array(aliases),
				year)
			return url
		except:
			return
Exemplo n.º 5
0
 def episode(self, url, imdb, tvdb, title, premiered, season, episode):
     try:
         if not url:
             return
         episode = tvmaze.tvMaze().episodeAbsoluteNumber(
             tvdb, int(season), int(episode))
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         data.update({'episode': episode})
         return urllib.urlencode(data)
     except:
         return
Exemplo n.º 6
0
	def episode(self, url, imdb, tvdb, title, premiered, season, episode):
		try:
			if not url:
				return
			url = urlparse.urljoin(self.base_link, url)
			episode = tvmaze.tvMaze().episodeAbsoluteNumber(tvdb, int(season), int(episode))
			r = client.request(url)
			r = dom_parser.parse_dom(r, 'article')
			r = dom_parser.parse_dom(r, 'div', attrs={'class': 'entry-content'})
			r = dom_parser.parse_dom(r, 'li')
			r = \
			dom_parser.parse_dom(r, 'a', attrs={'href': re.compile('.*-episode-%s-.*' % episode)}, req='href')[0].attrs[
				'href']
			return source_utils.strip_domain(r)
		except:
			return
Exemplo n.º 7
0
	def sources(self, url, hostDict, hostprDict):
		sources = []
		try:
			if not url:
				return sources
			data = urlparse.parse_qs(url)
			data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
			url = data.get('url')
			season = data.get('season')
			episode = data.get('episode')
			abs_episode = 0
			if season and episode:
				abs_episode = str(tvmaze.tvMaze().episodeAbsoluteNumber(data.get('tvdb'), int(season), int(episode)))
			url = urlparse.urljoin(self.base_link, url)
			r = client.request(url)
			r = r.decode('cp1251').encode('utf-8')
			r = dom_parser.parse_dom(r, 'div', attrs={'class': 'players'}, req='data-player')
			r = [(i.attrs['data-player'], dom_parser.parse_dom(i, 'a', req='href')) for i in r]
			r = [(i[0], i[1][0].attrs['href']) for i in r if i[1]]
			for post_id, play_url in r:
				i = client.request(play_url, referer=url, output='extended')
				headers = i[3]
				headers.update({'Cookie': i[2].get('Set-Cookie')})
				i = client.request(urlparse.urljoin(self.base_link, self.player_link), post={'post_id': post_id},
				                   headers=headers, referer=i, XHR=True)
				i = json.loads(i).get('message', {}).get('translations', {}).get('flash', {})
				for title, link in i.iteritems():
					try:
						link = self.decode_direct_media_url(link)
						if link.endswith('.txt'):
							link = self.decode_direct_media_url(client.request(link))
							link = json.loads(link).get('playlist', [])
							link = [i.get('playlist', []) for i in link]
							link = [x.get('file') for i in link for x in i if
							        (x.get('season') == season and x.get('serieId') == episode) or (
										        x.get('season') == '0' and x.get('serieId') == abs_episode)][0]
						urls = [(source_utils.label_to_quality(q), self.format_direct_link(link, q)) for q in
						        self.get_qualitys(link)]
						urls = [{'quality': x[0], 'url': x[1]} for x in urls if x[0] in ['SD', 'HD']]  # filter premium
						for i in urls:
							sources.append({'source': 'CDN', 'quality': i['quality'], 'info': title, 'language': 'ru',
							                'url': i['url'], 'direct': True, 'debridonly': False})
					except:
						pass
			return sources
		except:
			return sources
Exemplo n.º 8
0
	def episode(self, url, imdb, tvdb, title, premiered, season, episode):
		try:
			if not url:
				return
			data = urlparse.parse_qs(url)
			data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
			tvshowtitle = data['tvshowtitle']
			localtvshowtitle = data['localtvshowtitle']
			aliases = source_utils.aliases_to_array(eval(data['aliases']))
			year = data['year']
			episode = tvmaze.tvMaze().episodeAbsoluteNumber(tvdb, int(season), int(episode))
			url = self.__search([localtvshowtitle] + aliases, year, episode)
			if not url and tvshowtitle != localtvshowtitle:
				url = self.__search([tvshowtitle] + aliases, year, episode)
			return url
		except:
			return
Exemplo n.º 9
0
    def sources(self, url, hostDict, hostprDict):
        sources = []

        try:
            if not url:
                return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])
            tvshowtitle = data.get('tvshowtitle')
            localtvshowtitle = data.get('localtvshowtitle')
            aliases = source_utils.aliases_to_array(eval(data['aliases']))
            episode = tvmaze.tvMaze().episodeAbsoluteNumber(
                data.get('tvdb'), int(data.get('season')),
                int(data.get('episode')))

            alt_title = anilist.getAlternativTitle(tvshowtitle)
            links = self.__search([alt_title] + aliases, episode)
            if not links and localtvshowtitle != alt_title:
                links = self.__search([localtvshowtitle] + aliases, episode)
            if not links and tvshowtitle != localtvshowtitle:
                links = self.__search([tvshowtitle] + aliases, episode)

            for link in links:
                valid, host = source_utils.is_host_valid(link, hostDict)
                if not valid: continue

                sources.append({
                    'source': host,
                    'quality': 'SD',
                    'language': 'de',
                    'url': link,
                    'direct': False,
                    'debridonly': False
                })

            return sources
        except:
            return sources