link_preview 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6840fcd59b5ed32ebe40f088cadae78f686ba63a
4
- data.tar.gz: d8ac9700aefcd4a1f780b3aa67251b40ffe1f9cd
3
+ metadata.gz: 5b662c55f80ea8cfd8930b9330661fd479a06977
4
+ data.tar.gz: 64e9c6bbc68fcfc113471da67c06c3b22469566c
5
5
  SHA512:
6
- metadata.gz: 65eef63dc592f0cba38a1c29e5583ae22be197551cbd20278b6c6112489eade64116589ffe3fba9a9155bdc4d70a0fe2757567fec16e06f52be480d174a4b36e
7
- data.tar.gz: eb1716a97d274b60bf7d325babb1d6ccc2c9ed6c5f25798d86bb0951232f0e9e309264f3b60e85094793195476d97f1096b05d809f7db980adab75fec70051ff
6
+ metadata.gz: f82922a2ff9eeeb750a77dca1c650ba3e4700f286feb943dc4e2e612fdf39d7d4ef1664a9736700dba99b6be01c8d5c053a999d67cb10787e25dfe0032f970b5
7
+ data.tar.gz: 206b5c6e0f387a43e69605c118e71772a0e7ae52eac1946e5db5a6e3926b56da1dd54605aea22e6279087546e81d0b41ab1b3dc5e726504d6451da03896a2608
@@ -238,11 +238,11 @@ module LinkPreview
238
238
  def property_source_priority(property)
239
239
  case property
240
240
  when :description
241
- [:html, :oembed, :default]
241
+ [:html, :oembed, :opengraph_oembed, :opengraph, :default]
242
242
  when :image_data, :image_content_type, :image_file_name
243
- [:image, :oembed, :default]
243
+ [:image, :oembed, :opengraph_oembed, :opengraph, :default]
244
244
  else
245
- [:oembed, :html, :image, :default]
245
+ [:oembed, :opengraph_oembed, :opengraph, :html, :image, :default]
246
246
  end
247
247
  end
248
248
 
@@ -288,6 +288,7 @@ module LinkPreview
288
288
  version: '1.0',
289
289
  provider_name: site_name,
290
290
  provider_url: site_url,
291
+ url: url,
291
292
  title: title,
292
293
  description: description,
293
294
  type: 'link',
@@ -303,7 +304,7 @@ module LinkPreview
303
304
  end
304
305
 
305
306
  def content_type_video?
306
- content_type =~ %r{\Avideo/.*}
307
+ content_type =~ %r{\Avideo/.*} ? true : false
307
308
  end
308
309
 
309
310
  def content_type_flash?
@@ -311,11 +312,10 @@ module LinkPreview
311
312
  end
312
313
 
313
314
  def content_type_embed?
314
- get_property(:html)
315
+ get_property(:html) ? true : false
315
316
  end
316
317
 
317
318
  def content_html
318
- return unless content_url.present?
319
319
  return content_html_embed if content_type_embed?
320
320
  return content_html_video if content_type_video?
321
321
  return content_html_flash if content_type_flash?
@@ -118,6 +118,7 @@ module LinkPreview
118
118
 
119
119
  def parse_opengraph_video_data(doc)
120
120
  opengraph_video_array_first_elem = find_meta_property_array(doc, 'og:video').detect { |x| x['og:video:type'] != 'text/html' }
121
+ return {} unless opengraph_video_array_first_elem
121
122
  parse_opengraph_common_data(doc).merge(
122
123
  video_url: opengraph_video_array_first_elem['og:video'] || opengraph_video_array_first_elem['og:video:url'],
123
124
  video_secure_url: opengraph_video_array_first_elem['og:video:secure_url'],
@@ -19,5 +19,5 @@
19
19
  # SOFTWARE.
20
20
 
21
21
  module LinkPreview
22
- VERSION = '0.3.0'.freeze
22
+ VERSION = '0.3.1'.freeze
23
23
  end