<commit_before>import chalk from 'chalk'
import fs from 'fs'
import scrapeIt from 'scrape-it'
import _ from 'lodash'

const sites = ['http://www.expressen.se']

Array.prototype.delayedForEach = function(callback, timeout, thisArg) {
	var i = 0,
		l = this.length,
		self = this,
		caller = function() {
			callback.call(thisArg || self, self[i], i, self)
			++i < l && setTimeout(caller, timeout)
		}
	caller()
}

const scrapeExpressen = () => {
	sites.delayedForEach((urls, index) => {
		scrapeIt(urls, {
			articles: {
				listItem: '.b-ateaser',
				data: {
					title: '.teaser-component',
					url: {
						selector: 'a',
						attr: 'href'
					}
				}
			}
		}).then(page => {
			// console.log(page);
			fs.writeFileSync(
				'../../src/data/expressen.json',
				JSON.stringify(page),
				'utf-8'
			)
		})
	}, 2000)
}

export default scrapeExpressen
<commit_msg>New scraper dom settings<commit_after>import chalk from 'chalk'
import fs from 'fs'
import scrapeIt from 'scrape-it'
import _ from 'lodash'

const sites = ['http://www.expressen.se']

Array.prototype.delayedForEach = function(callback, timeout, thisArg) {
	var i = 0,
		l = this.length,
		self = this,
		caller = function() {
			callback.call(thisArg || self, self[i], i, self)
			++i < l && setTimeout(caller, timeout)
		}
	caller()
}

const scrapeExpressen = () => {
	sites.delayedForEach((urls, index) => {
		scrapeIt(urls, {
			articles: {
				listItem: '.teaser',
				data: {
					title: '.row h2',
					url: {
						selector: 'a.row',
						attr: 'href'
					}
				}
			}
		}).then(page => {
			// console.log(page);
			fs.writeFileSync(
				'../../src/data/expressen.json',
				JSON.stringify(page),
				'utf-8'
			)
		})
	}, 2000)
}

export default scrapeExpressen

{'fraction_non_alphanumeric': 0.17029816513761467, 'fraction_numerical': 0.007454128440366973, 'mean_word_length': 2.843612334801762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5816651', 'n_tokens_mistral': 786, 'n_tokens_neox': 641, 'n_words': 138}