<commit_before>require 'httparty'

class FilmSnob
  class VideoSite

    attr_reader :url, :options

    def initialize(url, options)
      @url = url
      @options = options
    end

    def id
      @id ||= matching_pattern.match(url)[1]
    end

    def site
      @site ||= self.class.to_s.split('::').last.downcase.to_sym
    end

    def self.valid_url_patterns
      []
    end

    def self.oembed_endpoint
      ''
    end

    def title
      oembed['title']
    end

    def html
      if oembed['html']
        oembed['html']
      else
        raise NotEmbeddableError.new("#{clean_url} is not embeddable")
      end
    end

    private

      def matching_pattern
        self.class.valid_url_patterns.find do |pattern|
          pattern.match(url)
        end
      end

      def oembed
        @oembed ||= HTTParty.get(
          self.class.oembed_endpoint,
          query: { url: clean_url }.merge(options)
        )
      end

  end
end
<commit_msg>Update video_site.rb with more semantic Ruby code.<commit_after>require 'httparty'

class FilmSnob
  class VideoSite

    attr_reader :url, :options

    def initialize(url, options)
      @url = url
      @options = options
    end

    def id
      @id ||= matching_pattern.match(url)[1]
    end

    def site
      @site ||= self.class.to_s.split('::').last.downcase.to_sym
    end

    def self.valid_url_patterns
      []
    end

    def self.oembed_endpoint
      ''
    end

    def title
      oembed['title']
    end

    def html
      oembed['html'] || (raise NotEmbeddableError.new("#{clean_url} is not embeddable"))
    end

    private

      def matching_pattern
        self.class.valid_url_patterns.find do |pattern|
          pattern.match(url)
        end
      end

      def oembed
        @oembed ||= HTTParty.get(
          self.class.oembed_endpoint,
          query: { url: clean_url }.merge(options)
        )
      end

  end
end

{'fraction_non_alphanumeric': 0.09538621047174702, 'fraction_numerical': 0.0010368066355624676, 'mean_word_length': 1.9242424242424243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4122216', 'n_tokens_mistral': 640, 'n_tokens_neox': 612, 'n_words': 144}