<commit_before>#!/usr/bin/env ruby
# <NAME>

require 'uri'
require 'open-uri'
require 'json'
require 'yaml'

module Duckgo
  # Do a raw api request based on paramaters
  def get(params, domain="https://api.duckduckgo.com", path="/") # domain can also just be plain duckduckgo.com
    endpoint = "#{domain}/#{path}?#{URI.encode_www_form(params)}"
    body = open(endpoint).read
    return body
  end

  # Get the data from DuckDuckGo's API
  # Paramaters used here:
  # {
  #   "q" => URI.encode_www_form(keywords),
  #   "format" => ["json", "xml"][format]
  # }
  def get_data(keywords, format=0)
  end

  # Get the bang redirect from DuckDuckGo's API
  # Paramaters used here:
  # {
  #   "q" => URI.encode_www_form("!#{bang} #{keywords}"),
  #   "format" => ["json", "xml"][format],
  #   "no_redirect" => [0, 1][no_redirect]
  # }
  def get_bang(bang, keywords, format=0, no_redirect=1)
  end

  # Get a website/page's favicon through duckduckgo's proxy
  def get_favicon(page)
    favicon = get(nil, endpoint, "/i/#{page}.ico")
    if favicon = "R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAICTAEAOw=="
      puts "Response is 200-OK, but content is empty"
      return nil<commit_msg>whoops conditional = ==<commit_after>#!/usr/bin/env ruby
# <NAME>

require 'uri'
require 'open-uri'
require 'json'
require 'yaml'

module Duckgo
  # Do a raw api request based on paramaters
  def get(params, domain="https://api.duckduckgo.com", path="/") # domain can also just be plain duckduckgo.com
    endpoint = "#{domain}/#{path}?#{URI.encode_www_form(params)}"
    body = open(endpoint).read
    return body
  end

  # Get the data from DuckDuckGo's API
  # Paramaters used here:
  # {
  #   "q" => URI.encode_www_form(keywords),
  #   "format" => ["json", "xml"][format]
  # }
  def get_data(keywords, format=0)
  end

  # Get the bang redirect from DuckDuckGo's API
  # Paramaters used here:
  # {
  #   "q" => URI.encode_www_form("!#{bang} #{keywords}"),
  #   "format" => ["json", "xml"][format],
  #   "no_redirect" => [0, 1][no_redirect]
  # }
  def get_bang(bang, keywords, format=0, no_redirect=1)
  end

  # Get a website/page's favicon through duckduckgo's proxy
  def get_favicon(page)
    favicon = get(nil, endpoint, "/i/#{page}.ico")
    if favicon == "R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAICTAEAOw=="
      puts "Response is 200-OK, but content is empty"
      return nil
{'fraction_non_alphanumeric': 0.15493544356518119, 'fraction_numerical': 0.008329862557267805, 'mean_word_length': 3.7470355731225298, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, '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': '3655309', 'n_tokens_mistral': 938, 'n_tokens_neox': 900, 'n_words': 217}