Sha256: fb44809ed6deb00ea3000c5333ed9b15dd512bdc0f39690eb44cda393ea90b51
Contents?: true
Size: 764 Bytes
Versions: 4
Compression:
Stored size: 764 Bytes
Contents
require 'yt/video_audit/base' module Yt module VideoAudit # Count how many videos have video description includes # a link to its own channel. class YoutubeAssociation < Base def title 'YouTube Association' end def description 'The number of videos with description has a link to its own channel' end private def valid?(video) video.description.split(' ').any? do |word| if Yt::URL::CHANNEL_PATTERNS.any?{|pattern| word.match pattern} url = Yt::URL.new word url.kind == :channel && channel_id(url) == video.channel_id end end end def channel_id(url) url.id rescue Yt::NoItemsError end end end end
Version data entries
4 entries across 4 versions & 1 rubygems