<commit_before>class LinkOracle
  class LinkData
    attr_reader :parsed_url

    def initialize(parsed_url)
      @parsed_url = parsed_url
    end

    #TODO: Need to write tests for these
    def title
      (og.title || meta.title || body.title).strip
    end

    def description
      (og.description || meta.description || body.description).strip
    end

    def image_url
      og.image_url || meta.image_url || body.image_url
    end

    def og
      @og ||= Extractor::OG.new(parsed_url).perform
    end

    def meta
      @meta ||= Extractor::Meta.new(parsed_url).perform
    end

    def body
      @body ||= Extractor::Body.new(parsed_url).perform
    end
  end
end<commit_msg>[SASQ-59] Fix link_data with missing metas<commit_after>class LinkOracle
  class LinkData
    attr_reader :parsed_url

    def initialize(parsed_url)
      @parsed_url = parsed_url
    end

    #TODO: Need to write tests for these
    def title
      title = og.title || meta.title || body.title
      title.strip if title
    end

    def description
      description = og.description || meta.description || body.description
      description.strip if description
    end

    def image_url
      og.image_url || meta.image_url || body.image_url
    end

    def og
      @og ||= Extractor::OG.new(parsed_url).perform
    end

    def meta
      @meta ||= Extractor::Meta.new(parsed_url).perform
    end

    def body
      @body ||= Extractor::Body.new(parsed_url).perform
    end
  end
end
{'fraction_non_alphanumeric': 0.09090909090909091, 'fraction_numerical': 0.0013468013468013469, 'mean_word_length': 2.5296912114014254, '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': '95137', 'n_tokens_mistral': 476, 'n_tokens_neox': 465, 'n_words': 118}