yt-audit 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/CHANGELOG.md +4 -0
- data/README.md +12 -0
- data/lib/yt/audit/version.rb +1 -1
- data/lib/yt/audit.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07648ff830a1df5bc0e21b44a531ba12edfd5493
|
4
|
+
data.tar.gz: f7c0adeba8ab719e191d80822a1d1d53a1a28698
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
+
[](https://travis-ci.org/Fullscreen/yt-audit)
|
8
|
+
[](https://coveralls.io/r/Fullscreen/yt-audit)
|
9
|
+
[](https://gemnasium.com/Fullscreen/yt-audit)
|
10
|
+
[](https://codeclimate.com/github/Fullscreen/yt-audit)
|
11
|
+
[](http://www.rubydoc.info/github/fullscreen/yt-audit/master/Yt/Audit)
|
12
|
+
[](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
|
```
|
data/lib/yt/audit/version.rb
CHANGED
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.
|
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
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yt
|