yt-audit 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2836fb86bee42998b942fbdd356c482e756481a1
4
- data.tar.gz: 932e69b0627fe1fdc4b981cc53b82234bafa7c7b
3
+ metadata.gz: 07648ff830a1df5bc0e21b44a531ba12edfd5493
4
+ data.tar.gz: f7c0adeba8ab719e191d80822a1d1d53a1a28698
5
5
  SHA512:
6
- metadata.gz: 47941e89187671d6d2bcfeadf36d437c4566d2f5dc282746a0f021a7e53336bb46e6237b74b9522abfd9d7d5978b66966472ffdb26bf18c2335b87010576580e
7
- data.tar.gz: e2ca1fbfec7693d4bb7a5c10eeb8869fe664f9a48a0292b3592aaac7cb11394545bf5a5246c026c84f9c409c12ed9a4269468bb3fd655f0ab5fbf24aacb63a97
6
+ metadata.gz: 0b140c256cefe29524e1bad90923c6fd066bb81fdf7c12baece33fdc52b62f43fa0913a92e8a399037a1075a461c3dca7f0b9501f89b56f6280703bc4a27b453
7
+ data.tar.gz: e18b322e4cd4e9cdcff473c3ebe37b5fd114fe12c7d7ee96d9d47aeb2a2cc28f31957900e7e7c2972262f4d42c7de9c39ac4fcaf44b3e1188320936e925175b5
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.0
3
+ - 2.3.0
4
4
  before_install: gem install bundler -v 1.11.2
5
+ env:
6
+ global:
7
+ secure: nWIde7eQEFDcalkJl01JR2lHBBycuc/jQIHaJK4GUA5pbBTXRTSzVdichBbpTktISRfnosSWEjRVLwu/EGPnBbJPFegtIBrDb4NXhVaAm0rr3gk22PDxT77ea2oEyozYmfsqIdVa4CXPDhRsjJEr5rH6Qxk8BHSTRJPx8LfxEDhmP5c/Yfkk0DVMt6bsVPNuRZjUNJNDn74aKSXxgAMt+crAFNtxM8D9FkB9xYwxqrltfK9Sk4wZEwfpossnAtzr/2DISOeQfBNtJrWCp0FDkyRBpku84EQkGdU7VKvWnjQXh4tFfdm3g647Z3v5ZgwuVuZ6ahtR+36IO7OA4ICj+BpLHJK0X3Pvflx2D/TDljvi0lIoW3iY1EbepG7WZcw72Z2twlDGhrrkqov+G3qHADDDJuQ+qhJrU1VPIJFLK9a0MSS2E5xFegTFIUBNecXQo22bieXL1cnCKg8/HeWac/mqt0SBBUh5Rb3LoieifognChV4nxePdZKsMZrYC5Yffgd093cIi+KDKIFTPIkRNJRDyN26Or8FeRTA103wWWdoOIHBL0/yGPs/xaz2rsQ9YWKAcIp96NHP2Lr1SH972BnQBJUeVLVjW3BGsK7fwVP/FLuKb2oLFCWtbspc2SqRRmq1RTx4oJ/Oso9XfpHZ+zijd4WSXeM5ghiDlXhjXu0=
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ For more information about changelogs, check
6
6
  [Keep a Changelog](http://keepachangelog.com) and
7
7
  [Vandamme](http://tech-angels.github.io/vandamme).
8
8
 
9
+ ## 0.1.3 - 2016.02.16
10
+
11
+ * [FEATURE] Add `has_link_to_own_channel?`
12
+
9
13
  ## 0.1.2 - 2016.02.11
10
14
 
11
15
  * [FEATURE] Add `has_subscribe_annotations?`
data/README.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Welcome! This is a Ruby library you can audit a YouTube video.
4
4
 
5
+ The **source code** is available on [GitHub](https://github.com/Fullscreen/yt-audit) and the **documentation** on [RubyDoc](http://www.rubydoc.info/github/fullscreen/yt-audit/master/Yt/Audit).
6
+
7
+ [![Build Status](http://img.shields.io/travis/Fullscreen/yt-audit/master.svg)](https://travis-ci.org/Fullscreen/yt-audit)
8
+ [![Coverage Status](http://img.shields.io/coveralls/Fullscreen/yt-audit/master.svg)](https://coveralls.io/r/Fullscreen/yt-audit)
9
+ [![Dependency Status](http://img.shields.io/gemnasium/Fullscreen/yt-audit.svg)](https://gemnasium.com/Fullscreen/yt-audit)
10
+ [![Code Climate](http://img.shields.io/codeclimate/github/Fullscreen/yt-audit.svg)](https://codeclimate.com/github/Fullscreen/yt-audit)
11
+ [![Online docs](http://img.shields.io/badge/docs-✓-green.svg)](http://www.rubydoc.info/github/fullscreen/yt-audit/master/Yt/Audit)
12
+ [![Gem Version](http://img.shields.io/gem/v/yt-audit.svg)](http://rubygems.org/gems/yt-audit)
13
+
14
+
5
15
  ## Development
6
16
 
7
17
  $ bin/setup
@@ -21,4 +31,6 @@ Yt::Audit.has_brand_anchoring?('rF711XAtrVg', 'Budweiser')
21
31
  # => true
22
32
  Yt::Audit.has_subscribe_annotations?('rF711XAtrVg')
23
33
  # => false
34
+ Yt::Audit.has_link_to_own_channel?('rF711XAtrVg')
35
+ # => false
24
36
  ```
@@ -1,5 +1,5 @@
1
1
  module Yt
2
2
  module Audit
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
data/lib/yt/audit.rb CHANGED
@@ -6,7 +6,6 @@ module Yt
6
6
  # Audit any info card of a video
7
7
  # @param [String] video_id the video to audit.
8
8
  # @return [Boolean] if the video has any info card.
9
- # @raise [NoMethodError] if video_id is not a valid video.
10
9
  def self.has_info_cards?(video_id)
11
10
  Yt::Annotations.for(video_id).any? do |annotation|
12
11
  annotation.is_a? Yt::Annotations::Card
@@ -17,7 +16,6 @@ module Yt
17
16
  # @param [String] video_id the video to audit.
18
17
  # @param [String] brand name of the video to audit.
19
18
  # @return [Boolean] if the video title includes brand name.
20
- # @raise [Yt::Errors::NoItems] if video_id is not a valid video.
21
19
  def self.has_brand_anchoring?(video_id, brand)
22
20
  video_title = Yt::Video.new(id: video_id).title
23
21
  !!video_title[/#{brand}/i]
@@ -26,11 +24,20 @@ module Yt
26
24
  # Audit any subscribe annotation of a video
27
25
  # @param [String] video_id the video to audit.
28
26
  # @return [Boolean] if the video has any link to subscribe in the annotations.
29
- # @raise [NoMethodError] if video_id is not a valid video.
30
27
  def self.has_subscribe_annotations?(video_id)
31
28
  Yt::Annotations.for(video_id).any? do |annotation|
32
29
  annotation.link && annotation.link[:type] == :subscribe
33
30
  end
34
31
  end
32
+
33
+ # Audit youtube association of a video
34
+ # @param [String] video_id the video to audit.
35
+ # @return [Boolean] if the video description has link to its own channel.
36
+ def self.has_link_to_own_channel?(video_id)
37
+ video = Yt::Video.new(id: video_id)
38
+ video.description.split(' ')
39
+ .select {|word| Yt::URL.new(word).kind == :channel }
40
+ .any? {|link| Yt::Channel.new(url: link).id == video.channel_id }
41
+ end
35
42
  end
36
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kang-Kyu Lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-11 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yt