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

class Sonic < Linkbot::Plugin

  def self.help
    "!sonic - get a dumb random sonic gif"
  end

  def self.on_message(message, matches)
    page = rand(29)
    doc = Hpricot(open("http://dumbrunningsonic.tumblr.com/page/#{page}").read)
    imgs = doc.search("div[@class=post-content] img").map {|x| x.attributes['src']}
    imgs[rand(imgs.length)]
  end

  Linkbot::Plugin.register('sonic', self, {
    :message => {:regex => /!sonic/i, :handler => :on_message, :help => :help}
  })
end<commit_msg>dumbrunningsonic changed their HTML... fix !sonic<commit_after>require 'open-uri'
require 'hpricot'

class Sonic < Linkbot::Plugin

  def self.help
    "!sonic - get a dumb random sonic gif"
  end

  def self.on_message(message, matches)
    page = rand(29)
    doc = Hpricot(open("http://dumbrunningsonic.tumblr.com/page/#{page}").read)
    imgs = doc.search("div[@class=contentwrap] img").map {|x| x.attributes['src']}
    imgs[rand(imgs.length)]
  end

  Linkbot::Plugin.register('sonic', self, {
    :message => {:regex => /!sonic/i, :handler => :on_message, :help => :help}
  })
end
{'fraction_non_alphanumeric': 0.17647058823529413, 'fraction_numerical': 0.003511852502194908, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7510136', 'n_tokens_mistral': 439, 'n_tokens_neox': 420, 'n_words': 86}