yt-audit 0.1.3 → 0.1.4

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: 07648ff830a1df5bc0e21b44a531ba12edfd5493
4
- data.tar.gz: f7c0adeba8ab719e191d80822a1d1d53a1a28698
3
+ metadata.gz: 20370ef1252c22d1d5d21298ca8b121863a774c9
4
+ data.tar.gz: 1d13aff30935f1be315d869c9507990f1643688e
5
5
  SHA512:
6
- metadata.gz: 0b140c256cefe29524e1bad90923c6fd066bb81fdf7c12baece33fdc52b62f43fa0913a92e8a399037a1075a461c3dca7f0b9501f89b56f6280703bc4a27b453
7
- data.tar.gz: e18b322e4cd4e9cdcff473c3ebe37b5fd114fe12c7d7ee96d9d47aeb2a2cc28f31957900e7e7c2972262f4d42c7de9c39ac4fcaf44b3e1188320936e925175b5
6
+ metadata.gz: d2b55c53a96d283c0c14d8c8308e01f5671819e00a84c6569a52070258eb3ca01609d1b526094e3cd60e7e7cc0d5053fc169ecab9beb6ba76ad58409b66bf8f6
7
+ data.tar.gz: 54fed6b319432abeed3bf11eadc64219f8832b13dce7218b3d5ed8f817a6c6294c41151393e59026d69819a60e2f6265053e05ebbc74fb45697fb51d48ce755b
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.4 - 2016.02.17
10
+
11
+ * [FEATURE] Add `has_end_cards?`
12
+
9
13
  ## 0.1.3 - 2016.02.16
10
14
 
11
15
  * [FEATURE] Add `has_link_to_own_channel?`
data/README.md CHANGED
@@ -33,4 +33,6 @@ Yt::Audit.has_subscribe_annotations?('rF711XAtrVg')
33
33
  # => false
34
34
  Yt::Audit.has_link_to_own_channel?('rF711XAtrVg')
35
35
  # => false
36
+ Yt::Audit.has_end_cards?('rF711XAtrVg')
37
+ # => false
36
38
  ```
@@ -1,5 +1,5 @@
1
1
  module Yt
2
2
  module Audit
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
data/lib/yt/audit.rb CHANGED
@@ -39,5 +39,18 @@ module Yt
39
39
  .select {|word| Yt::URL.new(word).kind == :channel }
40
40
  .any? {|link| Yt::Channel.new(url: link).id == video.channel_id }
41
41
  end
42
+
43
+ # Audit end cards of a video
44
+ # @param [String] video_id of the video to audit.
45
+ # @return [Boolean] if the video has any annotation, other than info cards,
46
+ # with a link in it, at the end of video, stays for more than 5 seconds.
47
+ def self.has_end_cards?(video_id)
48
+ video_duration = Yt::Video.new(id: video_id).duration
49
+ Yt::Annotations.for(video_id).any? do |annotation|
50
+ !annotation.is_a?(Yt::Annotations::Card) && annotation.link &&
51
+ annotation.ends_at.ceil == video_duration &&
52
+ video_duration - annotation.starts_at > 5
53
+ end
54
+ end
42
55
  end
43
56
  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.3
4
+ version: 0.1.4
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-16 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yt