<commit_before>class String
  def to_title
    gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase }.gsub(/([A-Z])/) { " #{$1}"}.gsub(/^([a-z])/) { $1.upcase }
  end
end<commit_msg>Add vine support<commit_after>require 'viddl-rb'
require 'nokogiri'
require 'open-uri'

class String
  def to_title
    gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase }.gsub(/([A-Z])/) { " #{$1}"}.gsub(/^([a-z])/) { $1.upcase }
  end
end

class Vine < ViddlRb::PluginBase
  def self.matches_provider?(url)
    url.include?("vine.co")
  end

  # return the url for original video file and title
  def self.get_urls_and_filenames(url, options = {})
    doc = Nokogiri::HTML(open(url))
    url = doc.css("head meta[property='twitter:player:stream']").first.attr("content")
    title = doc.css("head meta[property='twitter:title']").first.attr("content")
    
    [{:url => url, :name => title}]
  end
end
{'fraction_non_alphanumeric': 0.2277456647398844, 'fraction_numerical': 0.011560693641618497, 'mean_word_length': 3.73224043715847, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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': '724769', 'n_tokens_mistral': 354, 'n_tokens_neox': 358, 'n_words': 62}