<commit_before>Link.class_eval do

  validates_presence_of :title, :allow_blank => false

  # Method that returns a processed url with some enhancements:
  # - Adds http/s if not present
  # - Modifies urls from content providers (e.g. youtube, prezi, ...) if the url is not embeddable
  def getProcessedUrl
    urlWithProtocol = self.getUrlWithProtocol

    uri = URI(urlWithProtocol) rescue nil
    return urlWithProtocol if uri.nil? or uri.host.blank? or uri.path.blank? or uri.scheme.blank?
    myparams = uri.query.nil? ? [] : (CGI::parse(uri.query) rescue [])
    
    final_url = ""
    case
    when uri.host[/youtu.be|youtube.com/] && uri.path.start_with?("/watch")
      final_url = uri.scheme + "://" + uri.host + "/embed/" + myparams["v"][0]
    when uri.host[/prezi.com/] && !uri.path.start_with?("/embed/")
      presentation = uri.path[1..uri.path.index("/",1)-1]
      final_url = uri.scheme + "://" + uri.host + "/embed/" + presentation
    when uri.host[/slides.com/]  && !uri.path.end_with?("/embed")
      final_url = uri.scheme + "://" + uri.host +  uri.path.sub("#/","") + "/embed"
    when uri.host[/vimeo.com/] && uri.host[/player.vimeo.com/].nil?
      final_url = uri.scheme + "://" + "player." + uri.host + "/video" + uri.path
    else
      final_url = urlWithProtocol
    end

    final_url<commit_msg>prezi next integration<commit_after>Link.class_eval do

  validates_presence_of :title, :allow_blank => false

  # Method that returns a processed url with some enhancements:
  # - Adds http/s if not present
  # - Modifies urls from content providers (e.g. youtube, prezi, ...) if the url is not embeddable
  def getProcessedUrl
    urlWithProtocol = self.getUrlWithProtocol

    uri = URI(urlWithProtocol) rescue nil
    return urlWithProtocol if uri.nil? or uri.host.blank? or uri.path.blank? or uri.scheme.blank?
    myparams = uri.query.nil? ? [] : (CGI::parse(uri.query) rescue [])

    final_url = ""
    case
    when uri.host[/youtu.be|youtube.com/] && uri.path.start_with?("/watch")
      final_url = uri.scheme + "://" + uri.host + "/embed/" + myparams["v"][0]
    when uri.host[/prezi.com/] && (uri.path.start_with?("/view/") || uri.path.start_with?("/p/")) && !uri.path.end_with?("/embed/")
      presentation = uri.path[0..uri.path.index("/",7)-1]
      final_url = uri.scheme + "://" + uri.host + presentation + "/embed/"
    when uri.host[/prezi.com/] && !uri.path.start_with?("/embed/")
      presentation = uri.path[1..uri.path.index("/",1)-1]
      final_url = uri.scheme + "://" + uri.host + "/embed/" + presentation
    when uri.host[/slides.com/]  && !uri.path.end_with?("/embed")
      final_url = uri.scheme + "://" + uri.host +  uri.path.sub("#/","") + "/embed"
    when uri.host[/vimeo.com/] && uri.host[/player.vimeo.com/].nil?
      final_url = uri.scheme + "://" + "player." + uri.host + "/video" + uri.path
    else
      final_url = urlWithProtocol
    end
    final_url
{'fraction_non_alphanumeric': 0.18253155919481406, 'fraction_numerical': 0.0037529853292391675, 'mean_word_length': 2.9355704697986575, 'pattern_counts': {'":': 9, '<': 3, '<?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': '5996236', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1015, 'n_words': 209}