<commit_before>require 'rubygems'
require 'cinch'
require 'open-uri'
require 'hpricot'

class LinkTitles
	include Cinch::Plugin

	match /(http:\/\/.+?(?=\s|$))/

	def execute(m, url)
		m.channel.send "title of #{url} is #{LinkTitles.fetch_title url}"
	end

	def self.fetch_title url
		response = ''
		open(url, "User-Agent" => "Ruby/#{RUBY_VERSION}") do |f|
			response = f.read
		end
		doc = Hpricot(response)

		return (doc/"/html/head/title").inner_html
	end
end<commit_msg>argh. The plugin isn't working<commit_after>require 'rubygems'
require 'cinch'
require 'open-uri'
require 'hpricot'

class LinkTitles
	include Cinch::Plugin

	match /(https?:\/\/.+?)(?=\s|,|$)/

	def execute(m, url)
		m.reply "title of #{url} is #{LinkTitles.fetch_title url}"
	end

	def self.fetch_title url
		response = ''
		open(url, "User-Agent" => "Ruby/#{RUBY_VERSION}") do |f|
			response = f.read
		end
		doc = Hpricot(response)

		return (doc/"/html/head/title").inner_html
	end
end
{'fraction_non_alphanumeric': 0.17148760330578514, 'fraction_numerical': 0.0, 'mean_word_length': 4.020725388601036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4687530', 'n_tokens_mistral': 410, 'n_tokens_neox': 373, 'n_words': 89}