Exemplo n.º 1
0
	def filter_ads(url):
		adblock = Filter(file(ABSPATH+'/ressources/easylist.txt'), is_local=True)
		if len(adblock.match(self.url)) != 0:
			self.msg = 'Adblock url'
			self.status = False
			return False

		match_date = re.search(DATE_REGEX, self.url)
		# if we caught the verified date above, it's an article
		if match_date is not None:
			self.date = match_date.group()
		return True
Exemplo n.º 2
0
def filter_ads(url):
	info = {}
	info["url"] = url
	adblock = Filter(file(ABSPATH+'/ressources/easylist.txt'), is_local=True)
	if len(adblock.match(url)) != 0:
		info['msg'] = 'Adblock url'
		return (False, info)

	match_date = re.search(DATE_REGEX, url)
	# if we caught the verified date above, it's an article
	if match_date is not None:
		info["date"] = match_date.group()
		info['msg'] = 'verified for date: %s' % info["date"]
		return (True, info)
	else:
		return (True, info)