<commit_before>require 'open-uri'
require 'cgi'
require 'json'

# Since Google is in between Buzz and +1, lets
# make no assumptions on a default and fully qualify both
module TheCount
  module Google
    class Plus < Countable
      def initialize
        @service_name = "google"
        @unit = "shares"
        @value = 0
      end
      def count(data)
        url = "https://plusone.google.com/u/0/_/+1/fastbutton?url="
        url = "#{url}#{CGI::escape(data[:url])}"
        begin
          # like penut butter brittle
          @value = open(url).string.split('window.__SSR = {')[1].split('};')[0].split("'c':")[1].split(",")[0].strip.to_i
        rescue Exception => e
          puts e
          @value = 0
        end
      end
    end

    class Buzz < Countable
      def initialize
        @service_name = "google"
        @unit = "buzz"
        @value = 0
      end
      def count(data)<commit_msg>Update google.rb<commit_after>require 'open-uri'
require 'cgi'
require 'json'

# Since Google is in between Buzz and +1, lets
# make no assumptions on a default and fully qualify both
module TheCount
  module Google
    class Plus < Countable
      def initialize
        @service_name = "google"
        @unit = "shares"
        @value = 0
      end
      def count(data)
        url = "https://plusone.google.com/u/0/_/+1/fastbutton?url="
        url = "#{url}#{CGI::escape(data[:url])}"
        begin
          # like penut butter brittle
          @value = open(url).string.split('window.__SSR = {')[1].split('};')[0].split("c:")[1].split(",")[0].strip.to_i
        rescue Exception => e
          puts e
          @value = 0
        end
      end
    end

    class Buzz < Countable
      def initialize
        @service_name = "google"
        @unit = "buzz"
        @value = 0
      end
      def count(data)
{'fraction_non_alphanumeric': 0.131765992345544, 'fraction_numerical': 0.010934937124111536, 'mean_word_length': 2.0449251247920133, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '950164', 'n_tokens_mistral': 583, 'n_tokens_neox': 572, 'n_words': 158}