示例#1
0
    def _get_items(self, url):
        try:
            headers = {'User-Agent': client.agent()}
            r = client.request(url, headers=headers)
            if '<tbody' not in r:
                return self.items

            posts = client.parseDOM(r, 'tbody')[0]
            posts = client.parseDOM(posts, 'tr')

            for post in posts:
                data = client.parseDOM(post, 'a', ret='href')[1]
                link = urljoin(self.base_link, data)

                try:
                    seeders = int(
                        client.parseDOM(post,
                                        'td',
                                        attrs={'class': 'coll-2 seeds'
                                               })[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                name = client.parseDOM(post, 'a')[1]
                name = unquote_plus(name)
                name = source_utils.clean_name(self.title, name)
                if source_utils.remove_lang(name, self.episode_title):
                    continue

                if not source_utils.check_title(self.title, self.aliases, name,
                                                self.hdlr, self.year):
                    continue

                # filter for episode multi packs (ex. S01E01-E17 is also returned in query)
                if self.episode_title:
                    if not source_utils.filter_single_episodes(
                            self.hdlr, name):
                        continue

                try:
                    size = re.findall(
                        '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)[0]
                    dsize, isize = source_utils._size(size)
                except:
                    isize = '0'
                    dsize = 0
                    pass

                self.items.append((name, link, isize, dsize, seeders))

            return self.items

        except:
            source_utils.scraper_error('1337X')
            return self.items
示例#2
0
    def _get_items(self, url):
        try:
            headers = {'User-Agent': client.agent()}
            r = self.scraper.get(url, headers=headers).content
            if not r:
                return
            posts = client.parseDOM(r, 'table', attrs={'class': 'table2'})[0]
            posts = client.parseDOM(posts, 'tr')

            for post in posts:
                data = client.parseDOM(post, 'a', ret='href')[1]
                if '/search/' in data:
                    continue

                try:
                    data = data.encode('ascii', 'ignore')
                except:
                    pass

                data = re.sub('\s', '', data).strip()
                link = urljoin(self.base_link, data)

                name = client.parseDOM(post, 'a')[1]
                name = unquote_plus(name)
                name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                if source_utils.remove_lang(name):
                    continue

                match = source_utils.check_title(self.title, name, self.hdlr,
                                                 self.year)
                if not match:
                    continue

                try:
                    seeders = int(
                        client.parseDOM(post, 'td',
                                        attrs={'class':
                                               'tdseed'})[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                try:
                    size = re.findall(
                        '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)[0]
                    dsize, isize = source_utils._size(size)
                except:
                    isize = '0'
                    dsize = 0
                    pass

                self.items.append((name, link, isize, dsize, seeders))
            return self.items
        except:
            source_utils.scraper_error('LIMETORRENTS')
            return self.items
示例#3
0
	def get_sources(self, url):
		try:
			r = client.request(url)
			if r == str([]) or r == '' or r is None:
				return
			r = json.loads(r)
			results = r['results']

			for item in results:
				try:
					url = urllib.unquote_plus(item['magnet']).replace(' ', '.')
					url = re.sub(r'(&tr=.+)&dn=', '&dn=', url) # some links on solidtorrents &tr= before &dn=
					hash = item['infohash']

					name = item['title']
					name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
					if name.startswith('www'):
						try:
							name = re.sub(r'www(.*?)\W{2,10}', '', name)
						except:
							name = name.split('-.', 1)[1].lstrip()
					if source_utils.remove_lang(name):
						continue

					match = source_utils.check_title(self.title, name, self.hdlr, self.year)
					if not match:
						continue

					if url in str(self.sources):
						continue

					try:
						seeders = int(item['swarm']['seeders'])
						if self.min_seeders > seeders: 
							continue
					except:
						seeders = 0
						pass

					quality, info = source_utils.get_release_quality(name, url)

					try:
						dsize, isize = source_utils.convert_size(item["size"], to='GB')
						info.insert(0, isize)
					except:
						dsize = 0
						pass

					info = ' | '.join(info)

					self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
												'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
				except:
					source_utils.scraper_error('SOLIDTORRENTS')
					pass
		except:
			source_utils.scraper_error('SOLIDTORRENTS')
			pass
示例#4
0
	def _get_sources(self, url):
		try:
			r = client.request(url)
			div = client.parseDOM(r, 'div', attrs={'id': 'div2child'})

			for row in div:
				row = client.parseDOM(r, 'div', attrs={'class': 'resultdivbotton'})

				for post in row:
					hash = re.findall('<div id="hideinfohash.+?" class="hideinfohash">(.+?)<', post, re.DOTALL)[0]
					name = re.findall('<div id="hidename.+?" class="hideinfohash">(.+?)<', post, re.DOTALL)[0]
					name = unquote_plus(name)
					name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')

					if name.startswith('www'):
						try:
							name = re.sub(r'www(.*?)\W{2,10}', '', name)
						except:
							name = name.split('-.', 1)[1].lstrip()

					url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name)
					if url in str(self.sources):
						continue

					try:
						seeders = int(re.findall('<div class="resultdivbottonseed">([0-9]+|[0-9]+,[0-9]+)<', post, re.DOTALL)[0].replace(',', ''))
						if self.min_seeders > seeders:
							continue
					except:
						seeders = 0
						pass

					if source_utils.remove_lang(name):
						continue

					match = source_utils.check_title(self.title, name, self.hdlr, self.year)
					if not match:
						continue

					quality, info = source_utils.get_release_quality(name, url)

					try:
						size = re.findall('<div class="resultdivbottonlength">(.+?)<', post)[0]
						dsize, isize = source_utils._size(size)
						info.insert(0, isize)
					except:
						dsize = 0
						pass

					info = ' | '.join(info)

					self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
													'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
		except:
			source_utils.scraper_error('IDOPE')
			pass
示例#5
0
	def get_sources(self, link):
		try:
			url = re.compile('href="(.+?)"').findall(link)[0]
			url = '%s%s' % (self.base_link, url)
			result = client.request(url)
			if result is None:
				return
			if 'magnet' not in result:
				return

			url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', result, re.DOTALL)[0])
			url = unquote_plus(url).split('&xl=')[0].replace('&amp;', '&').replace(' ', '.')
			url = source_utils.strip_non_ascii_and_unprintable(url)
			if url in str(self.sources):
				return

			hash = re.compile('btih:(.*?)&').findall(url)[0]

			name = url.split('&dn=')[1]
			name = source_utils.clean_name(self.title, name)
			if source_utils.remove_lang(name, self.episode_title):
				return

			if not source_utils.check_title(self.title, self.aliases, name, self.hdlr, self.year):
				return

			# filter for episode multi packs (ex. S01E01-E17 is also returned in query)
			if self.episode_title:
				if not source_utils.filter_single_episodes(self.hdlr, name):
					return

			try:
				seeders = int(re.findall(r'<b>Seeds: </b>.*?>([0-9]+|[0-9]+,[0-9]+)</font>', result, re.DOTALL)[0].replace(',', ''))
				if self.min_seeders > seeders:
					return
			except:
				seeders = 0
				pass

			quality, info = source_utils.get_release_quality(name, url)

			try:
				size = re.findall(r'<b>Total Size:</b></td><td>(.*?)</td>', result, re.DOTALL)[0].strip()
				dsize, isize = source_utils._size(size)
				info.insert(0, isize)
			except:
				dsize = 0
				pass

			info = ' | '.join(info)

			self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
											'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
		except:
			source_utils.scraper_error('ETTV')
			pass
示例#6
0
    def _get_items(self, r):
        try:
            try:
                seeders = int(
                    re.search(r'<seeders>([\d]+)</seeders>',
                              r).groups()[0].replace(',', ''))
                if seeders < self.min_seeders:
                    return
            except:
                seeders = 0
                pass

            hash = re.search(r'<info_hash>([a-zA-Z0-9]+)</info_hash>',
                             r).groups()[0]
            name = re.search(r'<title>(.+?)</title>', r).groups()[0]
            name = urllib.unquote_plus(name)
            name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
            if source_utils.remove_lang(name):
                return

            match = source_utils.check_title(self.title, name, self.hdlr,
                                             self.year)
            if not match:
                return

            url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name)

            quality, info = source_utils.get_release_quality(name, url)

            try:
                size = re.search(r'<size>([\d]+)</size>', r).groups()[0]
                dsize, isize = source_utils.convert_size(float(size), to='GB')
                info.insert(0, isize)
            except:
                dsize = 0
                pass

            info = ' | '.join(info)

            self._sources.append({
                'source': 'torrent',
                'seeders': seeders,
                'hash': hash,
                'name': name,
                'quality': quality,
                'language': 'en',
                'url': url,
                'info': info,
                'direct': False,
                'debridonly': True,
                'size': dsize
            })
        except:
            source_utils.scraper_error('TORRENTDOWNLOADS')
            pass
示例#7
0
文件: glodls.py 项目: 17Q/modules4all
    def get_sources(self, url):
        items = []
        try:
            headers = {'User-Agent': client.agent()}
            r = client.request(url, headers=headers)
            posts = client.parseDOM(r, 'tr', attrs={'class': 't-row'})
            posts = [i for i in posts if not 'racker:' in i]

            for post in posts:
                ref = client.parseDOM(post, 'a', ret='href')
                url = [i for i in ref if 'magnet:' in i][0]

                name = client.parseDOM(post, 'a', ret='title')[0]
                name = unquote_plus(name)
                name = source_utils.clean_name(self.title, name)
                if source_utils.remove_lang(name, self.episode_title):
                    continue

                if not source_utils.check_title(self.title, self.aliases, name,
                                                self.hdlr, self.year):
                    continue

                # filter for episode multi packs (ex. S01E01-E17 is also returned in query)
                if self.episode_title:
                    if not source_utils.filter_single_episodes(
                            self.hdlr, name):
                        continue

                try:
                    seeders = int(
                        re.findall(
                            "<td.*?<font color='green'><b>([0-9]+|[0-9]+,[0-9]+)</b>",
                            post)[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                try:
                    size = re.findall(
                        '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)[0]
                    dsize, isize = source_utils._size(size)
                except:
                    isize = '0'
                    dsize = 0
                    pass

                items.append((name, url, isize, dsize, seeders))

            return items
        except:
            source_utils.scraper_error('GLODLS')
            return items
    def _get_items(self, url):
        try:
            headers = {'User-Agent': client.agent()}
            r = client.request(url, headers=headers)
            if '<tbody' not in r:
                return self.items

            posts = client.parseDOM(r, 'tbody')[0]
            posts = client.parseDOM(posts, 'tr')

            for post in posts:
                data = client.parseDOM(post, 'a', ret='href')[1]
                link = urlparse.urljoin(self.base_link, data)

                try:
                    seeders = int(
                        client.parseDOM(post,
                                        'td',
                                        attrs={'class': 'coll-2 seeds'
                                               })[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                name = client.parseDOM(post, 'a')[1]
                name = urllib.unquote_plus(name)
                name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                if source_utils.remove_lang(name):
                    continue

                match = source_utils.check_title(self.title, name, self.hdlr,
                                                 self.year)
                if not match:
                    continue

                try:
                    size = re.findall(
                        '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)[0]
                    dsize, isize = source_utils._size(size)
                except:
                    isize = '0'
                    dsize = 0
                    pass

                self.items.append((name, link, isize, dsize, seeders))

            return self.items

        except:
            source_utils.scraper_error('1337X')
            return self.items
示例#9
0
	def get_sources(self, url):
		# log_utils.log('url = %s' % url, __name__, log_utils.LOGDEBUG)
		try:
			headers = {'User-Agent': client.agent()}
			r = client.request(url, headers=headers)
			if not r:
				return
			posts = client.parseDOM(r, 'tr', attrs={'id': 'torrent_latest_torrents'})

			for post in posts:
				ref = client.parseDOM(post, 'a', attrs={'title': 'Torrent magnet link'}, ret='href')[0]
				link = ref.split('url=')[1]

				url = unquote_plus(link).replace('&amp;', '&').replace(' ', '.')
				url = url.split('&tr')[0]
				hash = re.compile('btih:(.*?)&').findall(url)[0]
				name = unquote_plus(url.split('&dn=')[1])
				name = source_utils.clean_name(self.title, name)
				if source_utils.remove_lang(name, self.episode_title):
					continue

				if not source_utils.check_title(self.title, self.aliases, name, self.hdlr, self.year):
					continue

				# filter for episode multi packs (ex. S01E01-E17 is also returned in query)
				if self.episode_title:
					if not source_utils.filter_single_episodes(self.hdlr, name):
						continue

				try:
					seeders = int(re.findall('<td class="green center">([0-9]+|[0-9]+,[0-9]+)</td>', post, re.DOTALL)[0].replace(',', ''))
					if self.min_seeders > seeders:
						continue
				except:
					seeders = 0
					pass

				quality, info = source_utils.get_release_quality(name, url)

				try:
					size = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0]
					dsize, isize = source_utils._size(size)
					info.insert(0, isize)
				except:
					dsize = 0
					pass

				info = ' | '.join(info)

				self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
											'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
		except:
			source_utils.scraper_error('KICKASS2')
			pass
示例#10
0
	def get_sources(self, url):
		try:
			r = client.request(url)
			if not r:
				return
			posts = client.parseDOM(r, 'tr')

			for post in posts:
				link = re.findall('a title="Download Torrent Magnet" href="(magnet:.+?)"', post, re.DOTALL)
				if not link:
					continue

				for url in link:
					url = unquote_plus(url).split('&tr')[0].replace('&amp;', '&').replace(' ', '.')
					url = source_utils.strip_non_ascii_and_unprintable(url)
					hash = re.compile('btih:(.*?)&').findall(url)[0]
					name = url.split('&dn=')[1]
					name = source_utils.clean_name(self.title, name)
					if source_utils.remove_lang(name, self.episode_title):
						continue

					if not source_utils.check_title(self.title, self.aliases, name, self.hdlr, self.year):
						continue

					# filter for episode multi packs (ex. S01E01-E17 is also returned in query)
					if self.episode_title:
						if not source_utils.filter_single_episodes(self.hdlr, name):
							continue

					try:
						seeders = int(client.parseDOM(post, 'td', attrs={'class': 'seeds is-hidden-sm-mobile'})[0].replace(',', ''))
						if self.min_seeders > seeders:
							continue
					except:
						seeders = 0
						pass

					quality, info = source_utils.get_release_quality(name, url)

					try:
						size = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0]
						dsize, isize = source_utils._size(size)
						info.insert(0, isize)
					except:
						dsize = 0
						pass

					info = ' | '.join(info)

					self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
													'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
		except:
			source_utils.scraper_error('BTSCENE')
			pass
    def _get_items(self, url):
        try:
            headers = {'User-Agent': client.agent()}
            r = client.request(url, headers=headers)
            posts = client.parseDOM(r,
                                    'tr',
                                    attrs={'id': 'torrent_latest_torrents'})

            for post in posts:
                ref = client.parseDOM(post,
                                      'a',
                                      attrs={'title': 'Torrent magnet link'},
                                      ret='href')[0]
                link = urllib.unquote(ref).decode('utf8').replace(
                    'https://mylink.me.uk/?url=',
                    '').replace('https://mylink.cx/?url=', '')

                name = urllib.unquote_plus(
                    re.search('dn=([^&]+)', link).groups()[0])
                name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                if source_utils.remove_lang(name):
                    continue

                match = source_utils.check_title(self.title, name, self.hdlr,
                                                 self.year)
                if not match:
                    continue

                try:
                    seeders = int(
                        re.findall(
                            '<td class="green center">([0-9]+|[0-9]+,[0-9]+)</td>',
                            post, re.DOTALL)[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                try:
                    size = re.findall(
                        '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)[0]
                    dsize, isize = source_utils._size(size)
                except:
                    isize = '0'
                    dsize = 0
                    pass

                self.items.append((name, link, isize, dsize, seeders))
            return self.items
        except:
            source_utils.scraper_error('KICKASS2')
            return self.items
示例#12
0
	def sources(self, url, hostDict, hostprDict):
		self._sources = []
		try:
			self.scraper = cfscrape.create_scraper()

			if url is None:
				return self._sources

			data = urlparse.parse_qs(url)
			data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])

			title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
			title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU')

			hdlr = 'S%02d' % (int(data['season'])) if 'tvshowtitle' in data else data['year']

			query = '%s %s' % (title, hdlr)
			query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

			url = self.search_link % urllib.quote_plus(query)
			url = urlparse.urljoin(self.base_link, url)
			# log_utils.log('url = %s' % url, log_utils.LOGDEBUG)

			r = self.scraper.get(url).content
			posts = client.parseDOM(r, 'figure')

			items = []
			for post in posts:
				try:
					url = client.parseDOM(post, 'a', ret='href')[0]
					name = client.parseDOM(post, 'img', ret='title')[0].replace(' ', '.')
					if source_utils.remove_lang(name):
						continue
					match = source_utils.check_title(title, name, hdlr, data['year'])
					if not match:
						continue
					items.append((url, name))
				except:
					source_utils.scraper_error('MKVHUB')
					pass

			threads = []
			for i in items:
				threads.append(workers.Thread(self._get_sources, i[0], i[1], hostDict, hostprDict))
			[i.start() for i in threads]
			[i.join() for i in threads]
			return self._sources
		except:
			source_utils.scraper_error('MKVHUB')
			return self._sources
    def _get_items(self, url):
        items = []
        try:
            headers = {'User-Agent': client.agent()}
            r = client.request(url, headers=headers)
            posts = client.parseDOM(r, 'tr', attrs={'class': 't-row'})
            posts = [i for i in posts if not 'racker:' in i]

            for post in posts:
                ref = client.parseDOM(post, 'a', ret='href')
                url = [i for i in ref if 'magnet:' in i][0]

                name = client.parseDOM(post, 'a', ret='title')[0]
                name = urllib.unquote_plus(name)
                name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                if source_utils.remove_lang(name):
                    continue

                match = source_utils.check_title(self.title, name, self.hdlr,
                                                 self.year)
                if not match:
                    continue

                try:
                    seeders = int(
                        re.findall(
                            "<td.*?<font color='green'><b>([0-9]+|[0-9]+,[0-9]+)</b>",
                            post)[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                try:
                    size = re.findall(
                        '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)[0]
                    dsize, isize = source_utils._size(size)
                except:
                    isize = '0'
                    dsize = 0
                    pass

                items.append((name, url, isize, dsize, seeders))

            return items
        except:
            source_utils.scraper_error('GLODLS')
            return items
示例#14
0
	def get_sources(self, link):
		try:
			url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', link, re.DOTALL)[0])
			url = unquote_plus(url).replace('&amp;', '&').replace(' ', '.')
			url = url.split('&tr')[0]
			try:
				url = url.encode('ascii', errors='ignore').decode('ascii', errors='ignore')
			except:
				pass

			hash = re.compile('btih:(.*?)&').findall(url)[0]

			name = url.split('&dn=')[1]
			name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
			if source_utils.remove_lang(name):
				return

			match = source_utils.check_title(self.title, name, self.hdlr, self.year)
			if not match:
				return

			if url in str(self.sources):
				return

			try:
				seeders = int(client.parseDOM(link, 'td', attrs={'class': 'sy'})[0].replace(',', ''))
				if self.min_seeders > seeders:
					return
			except:
				seeders = 0
				pass

			quality, info = source_utils.get_release_quality(name, url)

			try:
				size = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', link)[0]
				dsize, isize = source_utils._size(size)
				info.insert(0, isize)
			except:
				source_utils.scraper_error('EXTRATORRENT')
				dsize = 0
				pass

			info = ' | '.join(info)

			self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
											'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
		except:
			source_utils.scraper_error('EXTRATORRENT')
			pass
	def _get_sources(self, url):
		try:
			r = client.request(url)
			posts = client.parseDOM(r, 'tr')

			for post in posts:
				link = re.findall('a title="Download Torrent Magnet" href="(magnet:.+?)"', post, re.DOTALL)
				if link == []:
					continue

				for url in link:
					try:
						seeders = int(client.parseDOM(post, 'td', attrs={'class': 'seeds is-hidden-sm-mobile'})[0].replace(',', ''))
						if self.min_seeders > seeders:
							continue
					except:
						seeders = 0
						pass

					url = urllib.unquote_plus(url).replace('&amp;', '&').replace(' ', '.')
					url = url.split('&tr')[0]
					hash = re.compile('btih:(.*?)&').findall(url)[0]

					name = url.split('&dn=')[1]
					name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
					if source_utils.remove_lang(name):
						continue

					match = source_utils.check_title(self.title, name, self.hdlr, self.year)
					if not match:
						continue

					quality, info = source_utils.get_release_quality(name, url)

					try:
						size = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0]
						dsize, isize = source_utils._size(size)
						info.insert(0, isize)
					except:
						dsize = 0
						pass

					info = ' | '.join(info)

					self.sources.append({'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality,
													'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize})
		except:
			source_utils.scraper_error('BTSCENE')
			pass
示例#16
0
    def sources(self, url, hostDict, hostprDict):
        scraper = cfscrape.create_scraper()
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            title = title.replace('&', 'and').replace('Special Victims Unit',
                                                      'SVU')

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s %s' % (title, hdlr)
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            url = self.search_link % quote_plus(query)
            url = urljoin(self.base_link, url)
            # log_utils.log('url = %s' % url, log_utils.LOGDEBUG)

            r = scraper.get(url).content
            posts = client.parseDOM(r, 'div', attrs={'class': 'tgxtable'})

            for post in posts:
                links = zip(
                    re.findall('a href="(magnet:.+?)"', post, re.DOTALL),
                    re.findall(
                        r"<span class='badge badge-secondary' style='border-radius:4px;'>(.*?)</span>",
                        post, re.DOTALL),
                    re.findall(
                        r"<span title='Seeders/Leechers'>\[<font color='green'><b>(.*?)<",
                        post, re.DOTALL))

                for link in links:
                    url = unquote_plus(link[0]).split('&tr')[0].replace(
                        ' ', '.')
                    hash = re.compile('btih:(.*?)&').findall(url)[0]

                    name = url.split('&dn=')[1]
                    name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                    if source_utils.remove_lang(name):
                        continue

                    match = source_utils.check_title(title, name, hdlr,
                                                     data['year'])
                    if not match:
                        continue

                    try:
                        seeders = int(link[2])
                        if self.min_seeders > seeders:
                            continue
                    except:
                        seeders = 0
                        pass

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        dsize, isize = source_utils._size(link[1])
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass

                    info = ' | '.join(info)

                    sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
            return sources
        except:
            source_utils.scraper_error('TORRENTGALAXY')
            return sources
    def sources(self, url, hostDict, hostprDict):
        scraper = cfscrape.create_scraper()
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['title']
            year = data['year']

            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', title)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)
            # log_utils.log('url = %s' % url, log_utils.LOGDEBUG)

            try:
                r = scraper.get(url).content
                if r == str([]) or r == '':
                    return sources
                r = json.loads(r)

                id = ''
                for i in r:
                    if i['original_title'] == title and i[
                            'release_date'] == year:
                        id = i['id']
                        break

                if id == '':
                    return sources
                link = 'http://moviemagnet.co/movies/torrents?id=%s' % id
                result = scraper.get(link).content
                if 'magnet' not in result:
                    return sources

                result = re.sub(r'\n', '', result)
                links = re.findall(
                    r'<tr>.*?<a title="Download:\s*(.+?)"href="(magnet:.+?)">.*?title="File Size">\s*(.+?)\s*</td>.*?title="Seeds">([0-9]+|[0-9]+,[0-9]+)\s*<',
                    result)

                for link in links:
                    name = link[0]
                    name = urllib.unquote_plus(name)
                    name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                    if source_utils.remove_lang(name):
                        continue

                    match = source_utils.check_title(title, name, year, year)
                    if not match:
                        continue

                    url = link[1]
                    url = urllib.unquote_plus(url).decode('utf8').replace(
                        '&amp;', '&').replace(' ', '.')
                    url = url.split('&tr')[0]
                    hash = re.compile('btih:(.*?)&').findall(url)[0]

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = link[2]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass

                    info = ' | '.join(info)

                    try:
                        seeders = int(link[3].replace(',', ''))
                        if self.min_seeders > seeders:
                            continue
                    except:
                        seeders = 0
                        pass

                    sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
                return sources
            except:
                source_utils.scraper_error('MOVIEMAGNET')
                return sources
        except:
            source_utils.scraper_error('MOVIEMAGNET')
            return sources
示例#18
0
    def get_sources(self, link):
        try:
            url = '%s%s' % (self.base_link, link)
            result = client.request(url, timeout='5')

            if result is None:
                return
            if '<kbd>' not in result:
                return
            hash = re.findall('<kbd>(.+?)<', result, re.DOTALL)[0]
            url = '%s%s' % ('magnet:?xt=urn:btih:', hash)
            name = re.findall('<h3 class="card-title">(.+?)<', result,
                              re.DOTALL)[0].replace('Original Name: ', '')
            name = unquote_plus(name)
            name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
            if source_utils.remove_lang(name):
                return

            match = source_utils.check_title(self.title, name, self.hdlr,
                                             self.year)
            if not match:
                return

            url = '%s%s%s' % (url, '&dn=', str(name))
            if url in str(self.sources):
                return

            size = re.findall(
                '<div class="col-3">File size:</div><div class="col">(.+?)<',
                result, re.DOTALL)[0]
            quality, info = source_utils.get_release_quality(name, url)

            try:
                seeders = int(
                    re.findall(
                        '<div class="col-3">Seeders:</div><div class="col"><span style="color:green">([0-9]+|[0-9]+,[0-9]+)<',
                        result, re.DOTALL)[0].replace(',', ''))
                if self.min_seeders > seeders:
                    return
            except:
                seeders = 0
                pass

            try:
                size = re.findall(
                    '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))',
                    size)[0]
                dsize, isize = source_utils._size(size)
                info.insert(0, isize)
            except:
                dsize = 0
                pass

            info = ' | '.join(info)

            self.sources.append({
                'source': 'torrent',
                'seeders': seeders,
                'hash': hash,
                'name': name,
                'quality': quality,
                'language': 'en',
                'url': url,
                'info': info,
                'direct': False,
                'debridonly': True,
                'size': dsize
            })
        except:
            source_utils.scraper_error('YOURBITTORRENT')
            pass
示例#19
0
    def get_sources(self, link):
        try:
            url = '%s%s' % (self.base_link, link)
            result = client.request(url, timeout='5')
            if result is None:
                return
            if 'magnet' not in result:
                return

            url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', result,
                                            re.DOTALL)[0])
            try:
                url = unquote_plus(url).decode('utf8').replace('&amp;', '&')
            except:
                url = unquote_plus(url).replace('&amp;', '&')
            url = url.split('&tr=')[0].replace(' ', '.')
            if url in str(self.sources):
                return
            hash = re.compile('btih:(.*?)&').findall(url)[0]

            name = url.split('&dn=')[1]
            name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
            if name.startswith('www'):
                try:
                    name = re.sub(r'www(.*?)\W{2,10}', '', name)
                except:
                    name = name.split('-.', 1)[1].lstrip()
            if source_utils.remove_lang(name):
                return

            match = source_utils.check_title(self.title, name, self.hdlr,
                                             self.year)
            if not match:
                return

            try:
                seeders = int(
                    re.findall('<dt>SWARM</dt><dd>.*?>([0-9]+)</b>', result,
                               re.DOTALL)[0].replace(',', ''))
                if self.min_seeders > seeders:
                    return
            except:
                seeders = 0
                pass

            quality, info = source_utils.get_release_quality(name, url)

            try:
                size = re.findall('<dt>SIZE</dt><dd>(.*? [a-zA-Z]{2})', result,
                                  re.DOTALL)[0]
                dsize, isize = source_utils._size(size)
                info.insert(0, isize)
            except:
                dsize = 0
                pass

            info = ' | '.join(info)

            self.sources.append({
                'source': 'torrent',
                'seeders': seeders,
                'hash': hash,
                'name': name,
                'quality': quality,
                'language': 'en',
                'url': url,
                'info': info,
                'direct': False,
                'debridonly': True,
                'size': dsize
            })
        except:
            source_utils.scraper_error('TORLOCK')
            pass
示例#20
0
    def get_sources(self, link):
        try:
            url = link[0].encode('ascii', errors='ignore').decode(
                'ascii', errors='ignore').replace('&nbsp;', ' ')
            if '/torrent/' not in url:
                return

            name = link[1].encode('ascii', errors='ignore').decode(
                'ascii', errors='ignore').replace('&nbsp;',
                                                  '.').replace(' ', '.')
            name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
            if source_utils.remove_lang(name):
                return

            match = source_utils.check_title(self.title, name, self.hdlr,
                                             self.year)
            if not match:
                return

            if not url.startswith('http'):
                link = urlparse.urljoin(self.base_link, url)

            link = client.request(link)
            if link is None:
                return
            hash = re.findall('<b>Infohash</b></td><td valign=top>(.+?)</td>',
                              link, re.DOTALL)[0]
            url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name)
            if url in str(self.sources):
                return

            try:
                seeders = int(
                    re.findall(
                        '<b>Swarm:</b></td><td valign=top><font color=red>([0-9]+)</font>',
                        link, re.DOTALL)[0].replace(',', ''))
                if self.min_seeders > seeders:  # site does not seem to report seeders
                    return
            except:
                seeders = 0
                pass

            quality, info = source_utils.get_release_quality(name, url)

            try:
                size = re.findall(
                    '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                    link)[0]
                dsize, isize = source_utils._size(size)
                info.insert(0, isize)
            except:
                dsize = 0
                pass

            info = ' | '.join(info)

            self.sources.append({
                'source': 'torrent',
                'seeders': seeders,
                'hash': hash,
                'name': name,
                'quality': quality,
                'language': 'en',
                'url': url,
                'info': info,
                'direct': False,
                'debridonly': True,
                'size': dsize
            })
        except:
            source_utils.scraper_error('TORRENTFUNK')
            pass
示例#21
0
    def get_sources(self, url):
        try:
            scraper = cfscrape.create_scraper()
            r = scraper.get(url).content
            if not r:
                return
            posts = client.parseDOM(r, 'div', attrs={'class': 'media'})
            for post in posts:
                # file_name = client.parseDOM(post, 'span', attrs={'class': 'file-name'}) # file_name and &dn= differ 25% of the time.  May add check
                try:
                    seeders = int(
                        re.findall(
                            r'Seeders\s+:\s+<strong class="text-success">([0-9]+|[0-9]+,[0-9]+)</strong>',
                            post, re.DOTALL)[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        return
                except:
                    seeders = 0
                    pass

                link = re.findall('<a href="(magnet:.+?)"', post, re.DOTALL)
                for url in link:
                    url = unquote_plus(url).split('&tr')[0].replace(
                        '&amp;', '&').replace(' ', '.')
                    url = source_utils.strip_non_ascii_and_unprintable(url)

                    hash = re.compile('btih:(.*?)&').findall(url)[0]
                    name = url.split('&dn=')[1]
                    name = source_utils.clean_name(self.title, name)
                    if source_utils.remove_lang(name, self.episode_title):
                        continue

                    if not source_utils.check_title(self.title, self.aliases,
                                                    name, self.hdlr,
                                                    self.year):
                        continue

                    # filter for episode multi packs (ex. S01E01-E17 is also returned in query)
                    if self.episode_title:
                        if not source_utils.filter_single_episodes(
                                self.hdlr, name):
                            continue

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = re.findall(
                            '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))',
                            post)[0]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass

                    info = ' | '.join(info)

                    self.sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
        except:
            source_utils.scraper_error('BTDB')
            pass
    def sources(self, url, hostDict, hostprDict):
        scraper = cfscrape.create_scraper()
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['title']
            aliases = data['aliases']
            episode_title = data['title'] if 'tvshowtitle' in data else None
            year = data['year']

            query = re.sub('[^A-Za-z0-9\s\.-]+', '', title)

            url = self.search_link % quote_plus(query)
            url = urljoin(self.base_link, url)
            # log_utils.log('url = %s' % url, log_utils.LOGDEBUG)
            try:
                r = scraper.get(url).content
                if not r:
                    return sources
                if any(value in str(r) for value in
                       ['No movies found', 'something went wrong']):
                    return sources
                r = json.loads(r)

                id = ''
                for i in r:
                    if i['original_title'] == title and i[
                            'release_date'] == year:
                        id = i['id']
                        break
                if id == '':
                    return sources
                link = '%s%s%s' % (self.base_link, '/movies/torrents?id=', id)

                result = scraper.get(link).content
                if 'magnet' not in result:
                    return sources
                result = re.sub(r'\n', '', result)
                links = re.findall(
                    r'<tr>.*?<a title="Download:\s*(.+?)"href="(magnet:.+?)">.*?title="File Size">\s*(.+?)\s*</td>.*?title="Seeds">([0-9]+|[0-9]+,[0-9]+)\s*<',
                    result)

                for link in links:
                    name = link[0]
                    name = unquote_plus(name)
                    name = source_utils.clean_name(title, name)
                    if source_utils.remove_lang(name, episode_title):
                        continue

                    if not source_utils.check_title(title.replace('&', 'and'),
                                                    aliases, name, year, year):
                        continue

                    url = link[1]
                    try:
                        url = unquote_plus(url).decode('utf8').replace(
                            '&amp;', '&').replace(' ', '.')
                    except:
                        url = unquote_plus(url).replace('&amp;',
                                                        '&').replace(' ', '.')
                    url = url.split('&tr')[0]
                    hash = re.compile('btih:(.*?)&').findall(url)[0]

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = link[2]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass

                    info = ' | '.join(info)

                    try:
                        seeders = int(link[3].replace(',', ''))
                        if self.min_seeders > seeders:
                            continue
                    except:
                        seeders = 0
                        pass

                    sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
                return sources
            except:
                source_utils.scraper_error('MOVIEMAGNET')
                return sources
        except:
            source_utils.scraper_error('MOVIEMAGNET')
            return sources
示例#23
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            title = title.replace('&', 'and').replace('Special Victims Unit',
                                                      'SVU')

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s %s' % (title, hdlr)
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            url = urlparse.urljoin(self.base_link, self.search_link)
            url = url % urllib.quote_plus(query)
            # log_utils.log('url = %s' % url, log_utils.LOGDEBUG)

            r = client.request(url)
            if r is None:
                return sources
            if 'Nothing Found' in r:
                return sources

            r = client.parseDOM(r, 'article')
            r1 = client.parseDOM(r, 'h2')
            r2 = client.parseDOM(r, 'div', attrs={'class': 'entry-excerpt'})

            if 'tvshowtitle' in data:  # fuckers removed file size for episodes
                posts = zip(client.parseDOM(r1, 'a', ret='href'),
                            client.parseDOM(r1, 'a'))
            else:
                posts = zip(
                    client.parseDOM(r1, 'a', ret='href'),
                    client.parseDOM(r1, 'a'),
                    re.findall(
                        '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                        r2[0]))

            hostDict = hostprDict + hostDict

            items = []
            for post in posts:
                try:
                    base_u = client.request(post[0])

                    if 'tvshowtitle' in data:
                        regex = '<b>(' + title + '.*)</b>'
                        lists = zip(
                            re.findall(regex, base_u),
                            re.findall('<ul>(.+?)</ul>', base_u, re.DOTALL))
                        for links in lists:
                            u = re.findall('\'(http.+?)\'',
                                           links[1]) + re.findall(
                                               '\"(http.+?)\"', links[1])
                            t = links[0]
                            s = 0
                            items += [(t, i, s) for i in u]
                    else:
                        u = re.findall('\'(http.+?)\'', base_u) + re.findall(
                            '\"(http.+?)\"', base_u)
                        u = [i for i in u if '/embed/' not in i]
                        u = [i for i in u if 'youtube' not in i]

                        try:
                            t = post[1].encode('utf-8')
                        except:
                            t = post[1]
                        s = post[2]
                        items += [(t, i, s) for i in u]

                except:
                    source_utils.scraper_error('MYVIDEOLINK')
                    pass

            for item in items:
                try:
                    url = item[1]
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    if url.endswith(('.rar', '.zip', '.iso', '.part', '.png',
                                     '.jpg', '.bmp', '.gif')):
                        continue

                    valid, host = source_utils.is_host_valid(url, hostDict)
                    if not valid:
                        continue

                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    name = item[0]

                    name = client.replaceHTMLCodes(name).replace(' ', '.')
                    match = source_utils.check_title(title, name, hdlr,
                                                     data['year'])
                    if not match:
                        continue

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = re.findall(
                            '((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))',
                            item[2])[-1]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass

                    fileType = source_utils.getFileType(name)
                    info.append(fileType)
                    info = ' | '.join(info) if fileType else info[0]

                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
                except:
                    source_utils.scraper_error('MYVIDEOLINK')
                    pass

            return sources
        except:
            source_utils.scraper_error('MYVIDEOLINK')
            return sources
示例#24
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            title = title.replace('&', 'and').replace('Special Victims Unit',
                                                      'SVU')
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else ('(' +
                                                                 data['year'] +
                                                                 ')')

            # query = '%s %s' % (title, hdlr)
            query = title
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            if 'tvshowtitle' in data:
                url = self.show_link % query.replace(' ', '-')
            else:
                url = self.search_link % quote_plus(query)

            url = urljoin(self.base_link, url)
            # log_utils.log('url = %s' % url, __name__, log_utils.LOGDEBUG)

            r = client.request(url)
            if not r:
                return sources
            if 'No results were found' in r:
                return sources

            r = client.parseDOM(r, 'div', attrs={'class': 'card'})
            for i in r:
                url = re.compile('href="(magnet.+?)\s*?"').findall(i)[0]
                try:
                    url = unquote_plus(url).decode('utf8').replace(
                        '&amp;', '&').replace(' ', '.')
                except:
                    url = unquote_plus(url).replace('&amp;',
                                                    '&').replace(' ', '.')
                url = url.split('&tr=')[0].replace(' ', '.')
                hash = re.compile('btih:(.*?)&').findall(url)[0]

                name = url.split('&dn=')[1]
                name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                if source_utils.remove_lang(name):
                    continue

                match = source_utils.check_title(
                    title, name,
                    hdlr.replace('(', '').replace(')', ''), data['year'])
                if not match:
                    continue

                seeders = 0  # seeders not available on topnow
                quality, info = source_utils.get_release_quality(name, url)

                try:
                    size = re.findall(
                        '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', i
                    )[-1]  # file size is no longer available on topnow's new site
                    dsize, isize = source_utils._size(size)
                    info.insert(0, isize)
                except:
                    dsize = 0
                    pass

                info = ' | '.join(info)

                sources.append({
                    'source': 'torrent',
                    'seeders': seeders,
                    'hash': hash,
                    'name': name,
                    'quality': quality,
                    'language': 'en',
                    'url': url,
                    'info': info,
                    'direct': False,
                    'debridonly': True,
                    'size': dsize
                })

            return sources
        except:
            source_utils.scraper_error('TOPNOW')
            return sources
示例#25
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            title = title.replace('&', 'and').replace('Special Victims Unit',
                                                      'SVU')
            aliases = data['aliases']
            episode_title = data['title'] if 'tvshowtitle' in data else None
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s %s' % (title, hdlr)
            query = re.sub('[^A-Za-z0-9\s\.-]+', '', query)

            if 'tvshowtitle' in data:
                search_link = self.tvsearch.format(self.key, quote_plus(query))
            else:
                search_link = self.msearch.format(self.key, data['imdb'])
            # log_utils.log('search_link = %s' % search_link, log_utils.LOGDEBUG)

            time.sleep(2.1)
            rjson = client.request(search_link, error=True)
            if not rjson or not 'torrent_results' in str(rjson):
                return sources

            files = json.loads(rjson)['torrent_results']

            for file in files:
                url = file["download"]
                url = url.split('&tr')[0]
                hash = re.compile('btih:(.*?)&').findall(url)[0]

                name = file["title"]
                name = unquote_plus(name)
                name = source_utils.clean_name(title, name)
                if source_utils.remove_lang(name, episode_title):
                    continue

                if not source_utils.check_title(title, aliases, name, hdlr,
                                                data['year']):
                    continue

                # filter for episode multi packs (ex. S01E01-E17 is also returned in query)
                if episode_title:
                    if not source_utils.filter_single_episodes(hdlr, name):
                        continue

                try:
                    seeders = int(file["seeders"])
                    if self.min_seeders > seeders:
                        continue
                except:
                    seeders = 0
                    pass

                quality, info = source_utils.get_release_quality(name, name)

                try:
                    dsize, isize = source_utils.convert_size(file["size"],
                                                             to='GB')
                    info.insert(0, isize)
                except:
                    dsize = 0
                    pass

                info = ' | '.join(info)

                sources.append({
                    'source': 'torrent',
                    'seeders': seeders,
                    'hash': hash,
                    'name': name,
                    'quality': quality,
                    'language': 'en',
                    'url': url,
                    'info': info,
                    'direct': False,
                    'debridonly': True,
                    'size': dsize
                })
            return sources
        except:
            source_utils.scraper_error('TORRENTAPI')
            return sources
    def _get_sources(self, url):
        try:
            r = client.request(url)
            posts = client.parseDOM(r, 'div', attrs={'class': 'media'})

            for post in posts:
                # file_name = client.parseDOM(post, 'span', attrs={'class': 'file-name'}) # file_name and &dn= differ 25% of the time.  May add check
                try:
                    seeders = int(
                        re.findall(
                            r'Seeders\s+:\s+<strong class="text-success">([0-9]+|[0-9]+,[0-9]+)</strong>',
                            post, re.DOTALL)[0].replace(',', ''))
                    if self.min_seeders > seeders:
                        return
                except:
                    seeders = 0
                    pass

                link = re.findall('<a href="(magnet:.+?)"', post, re.DOTALL)

                for url in link:
                    url = urllib.unquote_plus(url).replace('&amp;',
                                                           '&').replace(
                                                               ' ', '.')
                    url = url.split('&tr')[0]
                    hash = re.compile('btih:(.*?)&').findall(url)[0]

                    name = url.split('&dn=')[1]
                    name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                    if source_utils.remove_lang(name):
                        continue

                    if name.startswith('www'):
                        try:
                            name = re.sub(r'www(.*?)\W{2,10}', '', name)
                        except:
                            name = name.split('-.', 1)[1].lstrip()

                    match = source_utils.check_title(self.title, name,
                                                     self.hdlr, self.year)
                    if not match:
                        continue

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = re.findall(
                            '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))',
                            post)[0]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass

                    info = ' | '.join(info)

                    self.sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
        except:
            source_utils.scraper_error('BTDB')
            pass
示例#27
0
    def _get_sources(self, url):
        try:
            r = client.request(url, timeout='5')
            posts = client.parseDOM(r, 'tbody')[0]
            posts = client.parseDOM(posts, 'tr')

            for post in posts:
                post = re.sub(r'\n', '', post)
                post = re.sub(r'\t', '', post)
                links = re.compile(
                    '<a href="(/torrent_details/.+?)"><span>(.+?)</span>.*?<td class="size-row">(.+?)</td><td class="sn">([0-9]+)</td>'
                ).findall(post)

                for items in links:
                    link = urljoin(self.base_link, items[0])
                    name = items[1]
                    name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                    if source_utils.remove_lang(name):
                        continue

                    match = source_utils.check_title(self.title, name,
                                                     self.hdlr, self.year)
                    if not match:
                        continue

                    try:
                        seeders = int(items[3].replace(',', ''))
                        if self.min_seeders > seeders:
                            continue
                    except:
                        seeders = 0
                        pass

                    link = client.request(link, timeout='5')
                    magnet = re.compile('(magnet.+?)"').findall(link)[0]
                    url = unquote_plus(magnet).replace('&amp;',
                                                       '&').replace(' ', '.')
                    url = url.split('&tr')[0]
                    hash = re.compile('btih:(.*?)&').findall(url)[0]

                    quality, info = source_utils.get_release_quality(name, url)
                    try:
                        size = re.findall(
                            '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))',
                            items[2])[0]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass
                    info = ' | '.join(info)

                    self.sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
        except:
            source_utils.scraper_error('ISOHUNT2')
            pass
示例#28
0
    def _get_sources(self, url):
        try:
            r = client.request(url)
            r = re.sub(r'\n', '', r)
            r = re.sub(r'\t', '', r)
            posts = re.compile(
                '<table class="table2" cellspacing="0">(.*?)</table>').findall(
                    r)
            posts = client.parseDOM(posts, 'tr')

            for post in posts:
                if '<th' in post:
                    continue
                links = re.compile(
                    '<a href="(.+?)">.*?<td class="tdnormal">((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))</td><td class="tdseed">([0-9]+|[0-9]+,[0-9]+)</td>'
                ).findall(post)

                for items in links:
                    link = items[0].split("/")
                    hash = link[1].lower()
                    name = link[2].replace('+MB+', '')
                    name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                    name = name.replace('Worldfree4u.Wiki.',
                                        '').replace('Bolly4u.pro.', '')
                    if source_utils.remove_lang(name):
                        continue

                    match = source_utils.check_title(self.title, name,
                                                     self.hdlr, self.year)
                    if not match:
                        continue

                    url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name)

                    try:
                        seeders = int(items[2].replace(',', ''))
                        if self.min_seeders > seeders:
                            continue
                    except:
                        seeders = 0
                        pass

                    quality, info = source_utils.get_release_quality(name, url)
                    try:
                        size = re.findall(
                            '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))',
                            items[1])[0]
                        dsize, isize = source_utils._size(size)
                        info.insert(0, isize)
                    except:
                        dsize = 0
                        pass
                    info = ' | '.join(info)

                    self.sources.append({
                        'source': 'torrent',
                        'seeders': seeders,
                        'hash': hash,
                        'name': name,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True,
                        'size': dsize
                    })
        except:
            source_utils.scraper_error('TORRENTDOWNLOAD')
            pass
    def sources(self, url, hostDict, hostprDict):
        scraper = cfscrape.create_scraper()
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            title = title.replace('&', 'and').replace('Special Victims Unit',
                                                      'SVU')

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s %s' % (title, hdlr)
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)
            # log_utils.log('url = %s' % url, log_utils.LOGDEBUG)

            try:
                r = scraper.get(url).content
                posts = client.parseDOM(r, 'div', attrs={'class':
                                                         'results'})[0]
                posts = client.parseDOM(posts, 'dl')

                for post in posts:
                    links = re.findall('<dt><a href=/(.+)</a>', post,
                                       re.DOTALL)
                    try:
                        seeders = int(
                            re.findall('<span>([0-9]+|[0-9]+,[0-9]+)</span>',
                                       post, re.DOTALL)[0].replace(',', ''))
                        if self.min_seeders > seeders:
                            continue
                    except:
                        seeders = 0
                        pass

                    for link in links:
                        hash = link.split('>')[0]
                        name = link.split('>')[1]
                        name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.')
                        if name.startswith('www'):
                            try:
                                name = re.sub(r'www(.*?)\W{2,10}', '', name)
                            except:
                                name = name.split('-.', 1)[1].lstrip()
                        if source_utils.remove_lang(name):
                            continue

                        match = source_utils.check_title(
                            title, name, hdlr, data['year'])
                        if not match:
                            continue

                        url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name)

                        quality, info = source_utils.get_release_quality(
                            name, url)

                        try:
                            size = re.findall(
                                '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                                post)[0]
                            dsize, isize = source_utils._size(size)
                            info.insert(0, isize)
                        except:
                            dsize = 0
                            pass

                        info = ' | '.join(info)

                        sources.append({
                            'source': 'torrent',
                            'seeders': seeders,
                            'hash': hash,
                            'name': name,
                            'quality': quality,
                            'language': 'en',
                            'url': url,
                            'info': info,
                            'direct': False,
                            'debridonly': True,
                            'size': dsize
                        })
                return sources
            except:
                source_utils.scraper_error('TORRENTZ')
                return
        except:
            source_utils.scraper_error('TORRENTZ')
            return sources
示例#30
0
    def get_sources(self, link):
        try:
            url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', link,
                                            re.DOTALL)[0])
            url = unquote_plus(url).split('&tr')[0].replace('&amp;',
                                                            '&').replace(
                                                                ' ', '.')
            url = source_utils.strip_non_ascii_and_unprintable(url)
            if url in str(self.sources):
                return

            hash = re.compile('btih:(.*?)&').findall(url)[0]

            name = url.split('&dn=')[1]
            name = source_utils.clean_name(self.title, name)
            if source_utils.remove_lang(name, self.episode_title):
                return

            if not source_utils.check_title(self.title, self.aliases, name,
                                            self.hdlr, self.year):
                return

            # filter for episode multi packs (ex. S01E01-E17 is also returned in query)
            if self.episode_title:
                if not source_utils.filter_single_episodes(self.hdlr, name):
                    return

            try:
                seeders = int(
                    client.parseDOM(link, 'td',
                                    attrs={'class': 'sy'})[0].replace(',', ''))
                if self.min_seeders > seeders:
                    return
            except:
                seeders = 0
                pass

            quality, info = source_utils.get_release_quality(name, url)

            try:
                size = re.findall(
                    '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                    link)[0]
                dsize, isize = source_utils._size(size)
                info.insert(0, isize)
            except:
                source_utils.scraper_error('EXTRATORRENT')
                dsize = 0
                pass

            info = ' | '.join(info)

            self.sources.append({
                'source': 'torrent',
                'seeders': seeders,
                'hash': hash,
                'name': name,
                'quality': quality,
                'language': 'en',
                'url': url,
                'info': info,
                'direct': False,
                'debridonly': True,
                'size': dsize
            })
        except:
            source_utils.scraper_error('EXTRATORRENT')
            pass