<commit_before>local ivar2 = ...
local util = require'util'

return function(url, callback)
	local x0 = ivar2.persist
	if(x0["x0:" .. url]) then
		local url = x0["x0:" .. url]

		return callback(url)
	end

	util.simplehttp(
		'http://api.x0.no/?' .. url,
		function(data, url)
			if(data:sub(8,9) =='x0') then
				x0["x0:" .. url] = data

				return callback(data)
			end
		end
	)
end
<commit_msg>x0: use @torhve 's URL shortener service<commit_after>local ivar2 = ...
local util = require'util'

return function(url, callback)
	local x0 = ivar2.persist
	if(x0["x0:" .. url]) then
		local url = x0["x0:" .. url]

		return callback(url)
	end

	util.simplehttp(
		'https://xt.gg/url?url=' .. url,
		function(data, url)
			data = util.json.decode(data).url
			x0["x0:" .. url] = data
			return callback(data)
		end
	)
end

{'fraction_non_alphanumeric': 0.1746031746031746, 'fraction_numerical': 0.028083028083028084, 'mean_word_length': 3.1, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '3246792', 'n_tokens_mistral': 361, 'n_tokens_neox': 329, 'n_words': 78}