youtube_embed 0.0.4 → 0.0.5

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.
@@ -37,27 +37,31 @@ module YoutubeEmbed
37
37
  video_id = get_video_id(video_url)
38
38
  if video_id.present?
39
39
  video_details = YoutubeEmbed::VideoDetails.new(video_id)
40
- thumbnails = video_details.thumbnail
41
- return %Q{<div class="youtube_embed_video">
42
- <div class="youtube_embed_partial_video">
43
- <div class="youtube_embed_thumbnail">
44
- <img src="#{thumbnails[1]["url"] ? thumbnails[1]["url"] : ""}" />
45
- </div>
46
- <div class="youtube_embed_details">
47
- <div class="youtube_embed_title">
48
- <strong>
49
- #{video_details.title["__content__"] ? video_details.title["__content__"] : ""}
50
- </strong>
40
+ if video_details.entry !='failed' #invalid video check
41
+ thumbnails = video_details.thumbnail
42
+ return %Q{<div class="youtube_embed_video">
43
+ <div class="youtube_embed_partial_video">
44
+ <div class="youtube_embed_thumbnail">
45
+ <img src="#{thumbnails[1]["url"] ? thumbnails[1]["url"] : ""}" />
51
46
  </div>
52
- <div class="youtube_embed_description">
53
- #{video_details.description["__content__"] ? video_details.description["__content__"].truncate(185) : ""}
47
+ <div class="youtube_embed_details">
48
+ <div class="youtube_embed_title">
49
+ <strong>
50
+ #{video_details.title["__content__"] ? video_details.title["__content__"] : ""}
51
+ </strong>
52
+ </div>
53
+ <div class="youtube_embed_description">
54
+ #{video_details.description["__content__"] ? video_details.description["__content__"].truncate(185) : ""}
55
+ </div>
54
56
  </div>
55
57
  </div>
56
- </div>
57
- <div class="youtube_embed_main_video" style="display:none;">
58
- <iframe title="YouTube player" width="#{ width }" height="#{ height }" src="http://www.youtube.com/embed/#{ video_id }" frameborder="0" allowfullscreen></iframe>
59
- </div>
60
- </div>}
58
+ <div class="youtube_embed_main_video" style="display:none;">
59
+ <iframe title="YouTube player" width="#{ width }" height="#{ height }" src="http://www.youtube.com/embed/#{ video_id }" frameborder="0" allowfullscreen></iframe>
60
+ </div>
61
+ </div>}
62
+ else
63
+ return video_url
64
+ end
61
65
  else
62
66
  return video_url
63
67
  end
@@ -1,3 +1,3 @@
1
1
  module YoutubeEmbed
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -31,7 +31,7 @@ module YoutubeEmbed
31
31
  end
32
32
  return @entry
33
33
  rescue MultiXml::ParseError
34
- raise InvalidVideoDetails
34
+ return 'failed'
35
35
  end
36
36
 
37
37
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube_embed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: