<commit_before>import scrapy
import re

class GetNews(Scrapy.Spider):
	name="appNewsCrawler"
	start_urls = getInitialURL()
	allow_domains = domains()
	
	def parser(self,response):
		for article in response.xpath("//article").extract():
			listWithoutTags=re.split("<[^>]+?>",article)
			fp=open(response.url,"w")
			fp.write(reduce(lambda x y: x+y,listWithoutTags))
			fp.close()
		
		fp=open("data/graph")
		for link in response.xpath("//a/@href").extract():
			if(prefixIsCorrect(link)):
				fp.write(response.url + " " + link)
				fp.close()
				yield response.follow(link,callback=self.parser)
			
			
	@support_function
	def prefixIsCorrect(link):
		for prefix in start_urls:
			if (re.match(prefix,link)):
				return True
		return False

	@support_function
	def getInitialURL():
		l=[]
		fp=open("sites","r")
		for line in fp:
			first,second = line.split(' ')
			category = second.split(',')
			for categories in category:
				l=l+[first + "/" + categories]
		fp.close()
		return l<commit_msg>no lambda<commit_after>import scrapy
import re

class GetNews(Scrapy.Spider):
	name="appNewsCrawler"
	start_urls = getInitialURL()
	allow_domains = domains()
	
	def parser(self,response):
		for article in response.xpath("//article").extract():
			listWithoutTags=re.split("<[^>]+?>",article)
			fp=open(response.url,"w")
			fp.write(concatAll(listWithoutTags))
			fp.close()
		
		fp=open("data/graph")
		for link in response.xpath("//a/@href").extract():
			if(prefixIsCorrect(link)):
				fp.write(response.url + " " + link)
				fp.close()
				yield response.follow(link,callback=self.parser)
			
	
	@support_function
	def concatAll(l):
		k=""
		for i in l:
			k=k+i
		return k
			
	@support_function
	def prefixIsCorrect(link):
		for prefix in start_urls:
			if (re.match(prefix,link)):
				return True
		return False

	@support_function
	def getInitialURL():
		l=[]
		fp=open("sites","r")
		for line in fp:
			first,second = line.split(' ')
			category = second.split(',')
			for categories in category:
				l=l+[first + "/" + categories]
		fp.close()
		return l
{'fraction_non_alphanumeric': 0.15843023255813954, 'fraction_numerical': 0.0, 'mean_word_length': 3.9759036144578315, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1135821', 'n_tokens_mistral': 843, 'n_tokens_neox': 713, 'n_words': 148}