<commit_before>'use strict'

const Http = require('http')

function run (msg, text) {
	msg.say('Lets play a word association game, tell me a word first.')
		.route('deviantart_response')
}

function DeviantArtResponse (msg) {
	// Make ajax request to deviant art random url
	var text = (msg.body.event && msg.body.event.text) || ''
	var url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=boost%3Apopular+in%3Adigitalart%2Fdrawings+' + text
	console.log(url)
	Http.get(url, function(res) {
		res.setEncoding('utf8');
		let raw_data = '';
		res.on('data', (chunk) => { raw_data += chunk; });
		res.on('end', () => {
			try {
				console.log(raw_data)
				// var parser = new DOMParser();
				// var xml_doc = parser.paserFromString(raw_data, 'text/xml')

				// console.log(xml_doc)

				// const parsed_data = JSON.parse(raw_data);
				// var page_id = Object.keys(parsed_data.query.pages)[0]
				// var title = parsed_data.query.pages[page_id].title
				// var extract = parsed_data.query.pages[page_id].extract
				// msg.say({
				// 	text: 'Tell me what you think of this random Wikipedia article:',<commit_msg>Console log raw data.<commit_after>'use strict'

const Http = require('http')

function run (msg, text) {
	msg.say('Lets play a word association game, tell me a word first.')
		.route('deviantart_response')
}

function DeviantArtResponse (msg) {
	// Make ajax request to deviant art random url
	var text = (msg.body.event && msg.body.event.text) || ''
	var url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=boost%3Apopular+in%3Adigitalart%2Fdrawings+' + text
	console.log(url)
	Http.get(url, function(res) {
		res.setEncoding('utf8');
		let raw_data = '';
		res.on('data', (chunk) => { raw_data += chunk; });
		console.log('Here is raw data')
		console.log(raw_data)
		res.on('end', () => {
			try {
				console.log(raw_data)
				// var parser = new DOMParser();
				// var xml_doc = parser.paserFromString(raw_data, 'text/xml')

				// console.log(xml_doc)

				// const parsed_data = JSON.parse(raw_data);
				// var page_id = Object.keys(parsed_data.query.pages)[0]
				// var title = parsed_data.query.pages[page_id].title
				// var extract = parsed_data.query.pages[page_id].extract
				// msg.say({
				// 	text: 'Tell me what you think of this random Wikipedia article:',
{'fraction_non_alphanumeric': 0.16018998272884283, 'fraction_numerical': 0.004317789291882556, 'mean_word_length': 3.6526104417670684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '3487253', 'n_tokens_mistral': 891, 'n_tokens_neox': 804, 'n_words': 179}