Class: Feedjira::Youtube::EntryParser

Inherits:
Parser::AtomYoutubeEntry
  • Object
show all
Defined in:
lib/feedjira/youtube/entry_parser.rb

Constant Summary collapse

URI.regexp(%w(http https))

Instance Method Summary collapse

Instance Method Details

#contentObject



20
21
22
# File 'lib/feedjira/youtube/entry_parser.rb', line 20

def content
  %(#{player_html}<br/><br/>#{summary})
end

#player_htmlObject



24
25
26
# File 'lib/feedjira/youtube/entry_parser.rb', line 24

def player_html
  %(<iframe width="600" height="375" src="https://www.youtube.com/embed/#{youtube_video_id}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>)
end

#summaryObject



11
12
13
14
15
16
17
18
# File 'lib/feedjira/youtube/entry_parser.rb', line 11

def summary
  return if super.nil?

  super
    .delete("\r")
    .gsub("\n", "<br/>\n")
    .gsub(LINK_REGEXP) { %(<a href="#{$&}">#{$&}</a>) }
end