video_info 2.6.1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/unit_test.yml +42 -0
  3. data/Guardfile +1 -1
  4. data/README.md +10 -21
  5. data/lib/video_info.rb +5 -4
  6. data/lib/video_info/provider.rb +17 -2
  7. data/lib/video_info/providers/dailymotion.rb +13 -0
  8. data/lib/video_info/providers/vimeo_api.rb +12 -12
  9. data/lib/video_info/providers/vimeo_scraper.rb +66 -16
  10. data/lib/video_info/providers/youtube.rb +12 -0
  11. data/lib/video_info/providers/youtube_api.rb +12 -13
  12. data/lib/video_info/providers/youtube_scraper.rb +45 -25
  13. data/lib/video_info/providers/youtubeplaylist_api.rb +15 -1
  14. data/lib/video_info/version.rb +1 -1
  15. data/tmp/rspec_guard_result +25 -0
  16. data/video_info.gemspec +9 -10
  17. metadata +24 -429
  18. data/.travis.yml +0 -14
  19. data/lib/video_info/providers/vkontakte.rb +0 -194
  20. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_invalid_video_url/_available_/1_2_2_1_1.yml +0 -89
  21. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -92
  22. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_date/should_show_correct_date.yml +0 -95
  23. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_description/1_3_7_1.yml +0 -95
  24. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_duration/1_3_9_1.yml +0 -95
  25. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_keywords/1_3_8_1.yml +0 -95
  26. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_large/1_3_15_1.yml +0 -95
  27. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/1_3_14_1.yml +0 -95
  28. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_small/1_3_13_1.yml +0 -95
  29. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_title/1_3_6_1.yml +0 -95
  30. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_view_count/1_3_16_1.yml +0 -95
  31. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/1_2_3_1_1.yml +0 -964
  32. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/2_2_3_1_1.yml +0 -59
  33. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/1_2_2_1_1.yml +0 -936
  34. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/2_2_2_1_1.yml +0 -61
  35. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -2692
  36. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/2_2_1_1_1.yml +0 -119
  37. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/1_3_17_1.yml +0 -1530
  38. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/2_3_17_1.yml +0 -68
  39. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/1_3_16_1.yml +0 -1530
  40. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/2_3_16_1.yml +0 -68
  41. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/1_3_18_1.yml +0 -1529
  42. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/2_3_18_1.yml +0 -68
  43. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_date/should_have_correct_upload_date.yml +0 -1595
  44. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/1_3_7_1.yml +0 -1602
  45. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/2_3_7_1.yml +0 -68
  46. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/1_3_9_1.yml +0 -1530
  47. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/2_3_9_1.yml +0 -68
  48. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/1_3_11_1.yml +0 -1529
  49. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/2_3_11_1.yml +0 -68
  50. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_keywords/should_return_a_string_list_of_keywords.yml +0 -1595
  51. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/1_3_15_1.yml +0 -1530
  52. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/2_3_15_1.yml +0 -68
  53. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/1_3_14_1.yml +0 -1530
  54. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/2_3_14_1.yml +0 -68
  55. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/1_3_13_1.yml +0 -1530
  56. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/2_3_13_1.yml +0 -68
  57. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/1_3_6_1.yml +0 -1602
  58. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/2_3_6_1.yml +0 -68
  59. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/1_3_19_1.yml +0 -1530
  60. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/2_3_19_1.yml +0 -68
  61. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/1_3_10_1.yml +0 -1530
  62. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/2_3_10_1.yml +0 -68
  63. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author/1_3_17_1.yml +0 -2559
  64. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author/2_3_17_1.yml +0 -159
  65. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_thumbnail/1_3_16_1.yml +0 -2559
  66. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_thumbnail/2_3_16_1.yml +0 -159
  67. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_url/1_3_18_1.yml +0 -2559
  68. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_url/2_3_18_1.yml +0 -159
  69. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_date/should_have_correct_upload_date.yml +0 -2714
  70. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/1_3_7_1.yml +0 -2692
  71. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/2_3_7_1.yml +0 -159
  72. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/1_3_9_1.yml +0 -2829
  73. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/2_3_9_1.yml +0 -159
  74. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/1_3_11_1.yml +0 -2828
  75. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/2_3_11_1.yml +0 -159
  76. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_keywords/should_return_a_string_list_of_keywords.yml +0 -2716
  77. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/1_3_15_1.yml +0 -2560
  78. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/2_3_15_1.yml +0 -159
  79. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/1_3_14_1.yml +0 -2558
  80. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/2_3_14_1.yml +0 -159
  81. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/1_3_13_1.yml +0 -2558
  82. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/2_3_13_1.yml +0 -159
  83. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/1_3_6_1.yml +0 -2961
  84. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/2_3_6_1.yml +0 -159
  85. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/1_3_19_1.yml +0 -2560
  86. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/2_3_19_1.yml +0 -159
  87. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/1_3_10_1.yml +0 -2560
  88. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/2_3_10_1.yml +0 -159
  89. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_hashes/available_/1_2_6_1_1.yml +0 -2996
  90. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_invalid_video/available_/1_2_2_1_1.yml +0 -46
  91. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_private_video/available_/1_2_3_1_1.yml +0 -865
  92. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect/available_/1_2_4_1_1.yml +0 -666
  93. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect_to_main_page_for_auth/available_/1_2_5_1_1.yml +0 -46
  94. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_valid_video/available_/1_2_1_1_1.yml +0 -2118
  95. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author/1_5_14_1.yml +0 -518
  96. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author_thumbnail/1_5_15_1.yml +0 -519
  97. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author_url/1_5_16_1.yml +0 -520
  98. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/description/1_5_8_1.yml +0 -518
  99. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/duration/1_5_10_1.yml +0 -517
  100. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/embed_code/1_5_6_1.yml +0 -517
  101. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/embed_url/1_5_5_1.yml +0 -519
  102. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/height/1_5_12_1.yml +0 -517
  103. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/title/1_5_7_1.yml +0 -517
  104. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/view_count/1_5_13_1.yml +0 -521
  105. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/width/1_5_11_1.yml +0 -517
  106. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/author/1_3_7_1.yml +0 -399
  107. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/embed_code/1_3_6_1.yml +0 -399
  108. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/embed_url/1_3_5_1.yml +0 -399
  109. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/title/1_3_4_1.yml +0 -399
  110. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video-54799401_165822734/title/1_7_4_1.yml +0 -682
  111. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video3552522_171340713/embed_url/1_10_1_1.yml +0 -501
  112. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/description/1_6_8_1.yml +0 -449
  113. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/duration/1_6_10_1.yml +0 -449
  114. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_code/1_6_6_1.yml +0 -449
  115. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_url/1_6_5_1.yml +0 -449
  116. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/height/1_6_12_1.yml +0 -449
  117. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/title/1_6_7_1.yml +0 -449
  118. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/view_count/1_6_13_1.yml +0 -449
  119. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/width/1_6_11_1.yml +0 -449
  120. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author/1_4_5_1.yml +0 -527
  121. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_thumbnail/1_4_6_1.yml +0 -527
  122. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_url/1_4_7_1.yml +0 -527
  123. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/title/1_4_4_1.yml +0 -527
  124. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_invalid_video/_available_/1_2_2_1_1.yml +0 -71
  125. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -73
  126. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_duration/1_4_7_1.yml +0 -80
  127. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_height/1_4_9_1.yml +0 -80
  128. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_large/1_4_12_1.yml +0 -80
  129. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_medium/1_4_11_1.yml +0 -80
  130. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_small/1_4_10_1.yml +0 -80
  131. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_title/1_4_6_1.yml +0 -80
  132. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_width/1_4_8_1.yml +0 -80
  133. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_duration/1_3_7_1.yml +0 -80
  134. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_height/1_3_9_1.yml +0 -80
  135. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_large/1_3_12_1.yml +0 -80
  136. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_medium/1_3_11_1.yml +0 -80
  137. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_small/1_3_10_1.yml +0 -80
  138. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_title/1_3_6_1.yml +0 -80
  139. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_width/1_3_8_1.yml +0 -80
  140. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/1_2_2_1_1.yml +0 -516
  141. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/2_2_2_1_1.yml +0 -56
  142. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/1_2_2_11_1.yml +0 -519
  143. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/2_2_2_11_1.yml +0 -56
  144. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/1_2_2_8_1.yml +0 -521
  145. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/2_2_2_8_1.yml +0 -56
  146. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/1_2_2_10_1.yml +0 -519
  147. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/2_2_2_10_1.yml +0 -56
  148. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/1_2_2_9_1.yml +0 -519
  149. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/2_2_2_9_1.yml +0 -56
  150. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/1_2_2_7_1.yml +0 -519
  151. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/2_2_2_7_1.yml +0 -56
  152. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_2_15_1.yml +0 -516
  153. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_2_15_1.yml +0 -56
  154. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -3930
  155. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/2_2_1_1_1.yml +0 -127
  156. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/1_2_3_1_1.yml +0 -578
  157. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/2_2_3_1_1.yml +0 -117
  158. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_date/should_return_date_video_was_posted.yml +0 -3912
  159. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/1_17_7_1.yml +0 -4007
  160. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/2_17_7_1.yml +0 -127
  161. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/1_17_9_1.yml +0 -3982
  162. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/2_17_9_1.yml +0 -127
  163. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/1_17_8_1.yml +0 -3984
  164. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/2_17_8_1.yml +0 -127
  165. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/1_17_6_1.yml +0 -3946
  166. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/2_17_6_1.yml +0 -127
  167. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/1_17_16_1.yml +0 -3948
  168. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/2_17_16_1.yml +0 -127
  169. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/1_3_6_1.yml +0 -4006
  170. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/2_3_6_1.yml +0 -127
  171. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/1_3_7_1.yml +0 -4027
  172. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/2_3_7_1.yml +0 -212
  173. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/1_3_8_1.yml +0 -4080
  174. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/2_3_8_1.yml +0 -212
  175. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_date/should_return_date_video_was_posted.yml +0 -3982
  176. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/1_3_10_1.yml +0 -3992
  177. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/2_3_10_1.yml +0 -127
  178. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/1_3_12_1.yml +0 -3961
  179. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/2_3_12_1.yml +0 -127
  180. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/1_3_11_1.yml +0 -3928
  181. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/2_3_11_1.yml +0 -127
  182. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/1_3_9_1.yml +0 -3974
  183. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/2_3_9_1.yml +0 -127
  184. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/1_3_19_1.yml +0 -3950
  185. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/2_3_19_1.yml +0 -127
  186. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/1_2_2_1_1.yml +0 -62
  187. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/2_2_2_1_1.yml +0 -62
  188. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/1_2_3_1_1.yml +0 -96
  189. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/2_2_3_1_1.yml +0 -96
  190. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/1_2_1_1_1.yml +0 -96
  191. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/2_2_1_1_1.yml +0 -96
  192. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/1_3_18_1.yml +0 -107
  193. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/2_3_18_1.yml +0 -107
  194. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/1_3_19_1.yml +0 -193
  195. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/2_3_19_1.yml +0 -193
  196. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/1_3_20_1.yml +0 -193
  197. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/2_3_20_1.yml +0 -193
  198. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/1_3_7_1.yml +0 -107
  199. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/2_3_7_1.yml +0 -107
  200. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/1_3_8_1.yml +0 -107
  201. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/2_3_8_1.yml +0 -107
  202. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/1_3_15_1.yml +0 -107
  203. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/2_3_15_1.yml +0 -107
  204. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/1_3_14_1.yml +0 -107
  205. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/2_3_14_1.yml +0 -107
  206. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/1_3_13_1.yml +0 -107
  207. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/2_3_13_1.yml +0 -107
  208. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/1_3_6_1.yml +0 -107
  209. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/2_3_6_1.yml +0 -107
  210. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_videos/returns_list_of_videos_in_playlist.yml +0 -267
  211. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/1_4_2_1.yml +0 -56
  212. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/2_4_2_1.yml +0 -56
  213. data/spec/lib/video_info/provider_spec.rb +0 -80
  214. data/spec/lib/video_info/providers/dailymotion_spec.rb +0 -174
  215. data/spec/lib/video_info/providers/vimeo_spec.rb +0 -277
  216. data/spec/lib/video_info/providers/vkontakte_spec.rb +0 -242
  217. data/spec/lib/video_info/providers/wistia_spec.rb +0 -189
  218. data/spec/lib/video_info/providers/youtube_playlist_spec.rb +0 -230
  219. data/spec/lib/video_info/providers/youtube_spec.rb +0 -557
  220. data/spec/lib/video_info_spec.rb +0 -106
  221. data/spec/spec_helper.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 18c94c937caae05276816dd3ed8ebe10df074b0b
4
- data.tar.gz: 61a33b65f281e74192fd355574616281b2ef2eb9
2
+ SHA256:
3
+ metadata.gz: 67a6553b4f475bfa408c26ce85d767137fc96929db2408b3d63d4ef001ccf3b7
4
+ data.tar.gz: f13ce187227e4e9fb2b85005ff9ee2cb533d6daca85e435051a502c5ebfd8587
5
5
  SHA512:
6
- metadata.gz: 06a186d5c3fea88716f226090c797a82bbee92f1180683b5963fc96684d87c37b2eb6b25b18a2016eeca714023c7c86f3c0b558dce3dbc0881bad507c4917d07
7
- data.tar.gz: 99f37329ca0c12666afd6f58e9f68af88dc62fe8d62a67ec542a074569bdd1b311c1f21fd86a56eb20ee1a7be4f8a576ffdd372050f808b439e3d8bb9f69d201
6
+ metadata.gz: fdfc18c5585413157163efc32673fe12e25a2a6562be97135cb3c9bd5d0813ac51ed04b1b1607da2ba8c255a4a1bae622466717d0cae5b1bdc10cf16f8c72204
7
+ data.tar.gz: e01f5f8358321e0c2e3e777f736341449c2929cabf351f0e5d5a918113635b130c34ec6e1e023689065207094dc147b90c14fb0171fa1e9124eb9bab8bd539b7
@@ -0,0 +1,42 @@
1
+ name: Ruby Unit Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby: [ '2.5', '2.6', '2.7' ]
15
+
16
+ name: Ruby ${{ matrix.ruby }}
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - name: Cache gems
23
+ uses: actions/cache@v2
24
+ env:
25
+ cache-name: cache-gems
26
+ with:
27
+ path: vendor/bundle
28
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
29
+ restore-keys: |
30
+ ${{ runner.os }}-gems-
31
+ - name: Install bundler
32
+ run: |
33
+ gem install bundler
34
+ - name: Set bundle config path
35
+ run: |
36
+ bundle config path vendor/bundle
37
+ - name: Install dependencies
38
+ run: |
39
+ bundle install
40
+ - name: Ruby Unit tests
41
+ run: |
42
+ bundle exec rspec
data/Guardfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # A sample Guardfile
2
2
  # More info at http://github.com/guard/guard#readme
3
3
 
4
- guard 'rspec', keep_failed: false do
4
+ guard 'rspec', cmd: "bundle exec rspec" do
5
5
  watch('spec/spec_helper.rb') { 'spec' }
6
6
  watch(%r{lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
7
  watch(%r{spec/.+_spec\.rb})
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # VideoInfo
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/video_info.svg)](http://badge.fury.io/rb/video_info) [![Build Status](https://travis-ci.org/thibaudgg/video_info.svg?branch=master)](https://travis-ci.org/thibaudgg/video_info) [![Dependency Status](https://gemnasium.com/thibaudgg/video_info.svg)](https://gemnasium.com/thibaudgg/video_info) [![Code Climate](https://codeclimate.com/github/thibaudgg/video_info.svg)](https://codeclimate.com/github/thibaudgg/video_info) [![Coverage Status](https://coveralls.io/repos/thibaudgg/video_info/badge.svg?branch=master)](https://coveralls.io/r/thibaudgg/video_info)
3
+ [![Gem Version](https://badge.fury.io/rb/video_info.svg)](http://badge.fury.io/rb/video_info) [![Build Status](https://github.com/thibaudgg/video_info/workflows/Ruby%20Unit%20Tests/badge.svg?branch=master)](https://github.com/thibaudgg/video_info/actions?query=workflow%3A%22Ruby+Unit+Tests%22) [![Code Climate](https://codeclimate.com/github/thibaudgg/video_info.svg)](https://codeclimate.com/github/thibaudgg/video_info) [![Coverage Status](https://coveralls.io/repos/thibaudgg/video_info/badge.svg?branch=master)](https://coveralls.io/r/thibaudgg/video_info) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
4
4
 
5
- Simple Ruby Gem to get video info from Dailymotion, VK, Vimeo, Wistia and YouTube (with playlist).
5
+ Simple Ruby Gem to get video info from Dailymotion, Vimeo, Wistia and YouTube (with playlist).
6
6
 
7
- Tested against Ruby 2.3.0, 2.2.4, and the latest versions of JRuby & Rubinius.
7
+ Tested against Ruby 2.5.x, 2.6.x and 2.7.x.
8
8
 
9
9
  Features
10
10
  --------
@@ -28,10 +28,12 @@ Usage
28
28
 
29
29
  Youtube and Vimeo have recently updated their APIs to require API keys.
30
30
 
31
- Scrapers has been implemented for both Youtube and Vimeo. However, the Youtube scraper can only get the date the video was posted, while the API is able to get the date and the exact time the video was posted. You may also wish to use the API to protect against potential HTML changes that could break the scrapesr.
31
+ Scrapers has been implemented for both Youtube and Vimeo. However, the Youtube scraper can only get the date the video was posted, while the API is able to get the date and the exact time the video was posted. You may also wish to use the API to protect against potential HTML changes that could break the scrapers.
32
32
 
33
33
  To get a Youtube API key, [follow the instructions here](https://developers.google.com/youtube/registering_an_application)
34
34
 
35
+ After generating a Youtube API key it is necessary to enable the YouTube Data API for the project which your API key was generated [enable Youtube Data API here](https://console.developers.google.com/apis/library/youtube.googleapis.com)
36
+
35
37
  To get a Vimeo API key, [follow the instructions here](https://developer.vimeo.com/api/start)
36
38
 
37
39
  To set the API keys, do the following:
@@ -89,19 +91,6 @@ video = VideoInfo.new("http://fast.wistia.com/embed/medias/pxonqr42is")
89
91
  # video.embed_url => '//fast.wistia.net/embed/iframe/pxonqr42is'
90
92
  # video.embed_code => "<iframe src='//fast.wistia.net/embed/iframe/pxonqr42is' frameborder='0'></iframe>"
91
93
 
92
- video = VideoInfo.new('http://vk.com/video39576223_108370515')
93
- # video.available? => true
94
- # video.provider => "Vkontakte"
95
- # video.video_id => "108370515"
96
- # video.author => "Alexander Maslov"
97
- # video.author_thumbnail => "https://pp.vk.me/c624521/v624521223/3c288/lVcVW7LNnrQ.jpg"
98
- # video.author_url => "https://vk.com/videos39576223"
99
- # video.title => "Я уточка)))))"
100
- # video.description => "это ВЗРЫВ МОЗГА!!!<br>Просто отвал башки..."
101
- # video.duration => 183 (in seconds)
102
- # video.embed_url => "//vk.com/video_ext.php?oid=39576223&id=108370515&hash=15184dbd085c47af"
103
- # video.embed_code => "<iframe src=\"//vk.com/video_ext.php?oid=39576223&id=108370515&hash=15184dbd085c47af\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe>"
104
-
105
94
  video = VideoInfo.new("http://www.youtube.com/watch?v=mZqGqE0D0n4")
106
95
  # video.available? => true
107
96
  # video.video_id => 'mZqGqE0D0n4'
@@ -161,7 +150,7 @@ You can also include an `iframe_attributes` or `url_attributes` hash to the `emb
161
150
  VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4').embed_code(iframe_attributes: { width: 800, height: 600, 'data-key' => 'value' })
162
151
  => '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen" width="800" height="600" data-key="value"></iframe>'
163
152
 
164
- 'VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4').embed_code(url_attributes: { autoplay: 1 })
153
+ VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4').embed_code(url_attributes: { autoplay: 1 })
165
154
  => '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4?autoplay=1" frameborder="0" allowfullscreen="allowfullscreen"></iframe>'
166
155
  ```
167
156
 
@@ -185,9 +174,9 @@ Author
185
174
  Maintainers
186
175
  -----------
187
176
 
188
- [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
189
-
190
- [Vincent Heuken](https://github.com/vheuken) ([@vheuken](https://github.com/vheuken))
177
+ - [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
178
+ - [Vincent Heuken](https://github.com/vheuken) ([@vheuken](https://github.com/vheuken))
179
+ - [João Vieira](https://github.com/joaocv3) ([@joaocv3](https://github.com/joaocv3))
191
180
 
192
181
  Contributors
193
182
  ------------
data/lib/video_info.rb CHANGED
@@ -10,8 +10,7 @@ class VideoInfo
10
10
  class HttpError < Error; end
11
11
 
12
12
  class << self
13
- attr_writer :logger
14
- attr_accessor :disable_providers, :provider_api_keys
13
+ attr_writer :logger, :disable_providers
15
14
 
16
15
  def disable_providers
17
16
  @disable_providers || []
@@ -38,7 +37,7 @@ class VideoInfo
38
37
  extend Forwardable
39
38
 
40
39
  PROVIDERS = %w[
41
- Dailymotion Vkontakte Wistia
40
+ Dailymotion Wistia
42
41
  Vimeo Youtube YoutubePlaylist
43
42
  ].freeze
44
43
  PROVIDERS.each { |p| require "video_info/providers/#{p.downcase}" }
@@ -50,7 +49,9 @@ class VideoInfo
50
49
  def_delegators :@provider,
51
50
  :thumbnail_small,
52
51
  :thumbnail_medium,
53
- :thumbnail_large
52
+ :thumbnail_large,
53
+ :thumbnail_large_2x,
54
+ :thumbnail_maxres
54
55
  def_delegators :@provider, :embed_code, :embed_url
55
56
  def_delegators :@provider, :available?
56
57
  def_delegators :@provider, :playlist_id, :videos
@@ -4,7 +4,8 @@ require 'uri'
4
4
 
5
5
  class VideoInfo
6
6
  class Provider
7
- attr_accessor :url, :options, :iframe_attributes, :video_id, :data
7
+ attr_accessor :url, :options, :iframe_attributes, :video_id
8
+ attr_writer :data
8
9
 
9
10
  def initialize(url, options = {})
10
11
  @options = _clean_options(options)
@@ -36,6 +37,20 @@ class VideoInfo
36
37
  !%w[403 404 400].include?(_response_code)
37
38
  end
38
39
 
40
+ def thumbnail
41
+ if defined?(thumbnail_large)
42
+ thumbnail_large
43
+ end
44
+ end
45
+
46
+ def thumbnail_large_2x
47
+ nil
48
+ end
49
+
50
+ def thumbnail_maxres
51
+ nil
52
+ end
53
+
39
54
  private
40
55
 
41
56
  def _response_code
@@ -95,7 +110,7 @@ class VideoInfo
95
110
  end
96
111
 
97
112
  def _set_data_from_api_impl(api_url)
98
- uri = open(api_url, options)
113
+ uri = URI.open(api_url, options)
99
114
  JSON.load(uri.read)
100
115
  end
101
116
 
@@ -17,6 +17,18 @@ class VideoInfo
17
17
  define_method(method) { nil }
18
18
  end
19
19
 
20
+ def author
21
+ data['owner.screenname']
22
+ end
23
+
24
+ def author_url
25
+ data['owner.url']
26
+ end
27
+
28
+ def author_thumbnail
29
+ data['owner.avatar_60_url']
30
+ end
31
+
20
32
  def keywords
21
33
  data['tags']
22
34
  end
@@ -71,6 +83,7 @@ class VideoInfo
71
83
  "https://#{_api_base}#{_api_path}?" \
72
84
  'fields=id,title,description,duration,created_time,' \
73
85
  'url,views_total,tags,thumbnail_url,thumbnail_720_url,' \
86
+ 'owner.url,owner.screenname,owner.avatar_60_url,' \
74
87
  'thumbnail_240_url,thumbnail_60_url'
75
88
  end
76
89
 
@@ -39,25 +39,16 @@ class VideoInfo
39
39
  @thumbnail_id ||= _parse_picture_id(_video['pictures']['uri'])
40
40
  end
41
41
 
42
- def thumbnail(width = 200, height = nil)
43
- base_uri = "https://i.vimeocdn.com/video/#{thumbnail_id}"
44
- if height
45
- base_uri + "_#{width}x#{height}.jpg"
46
- else
47
- base_uri + "_#{width}.jpg"
48
- end
49
- end
50
-
51
42
  def thumbnail_small
52
- thumbnail(100, 75)
43
+ generate_thumbnail(100, 75)
53
44
  end
54
45
 
55
46
  def thumbnail_medium
56
- thumbnail(200, 150)
47
+ generate_thumbnail(200, 150)
57
48
  end
58
49
 
59
50
  def thumbnail_large
60
- thumbnail(640)
51
+ generate_thumbnail(640)
61
52
  end
62
53
 
63
54
  def keywords
@@ -78,6 +69,15 @@ class VideoInfo
78
69
 
79
70
  private
80
71
 
72
+ def generate_thumbnail(width = 200, height = nil)
73
+ base_uri = "https://i.vimeocdn.com/video/#{thumbnail_id}"
74
+ if height
75
+ base_uri + "_#{width}x#{height}.jpg"
76
+ else
77
+ base_uri + "_#{width}.jpg"
78
+ end
79
+ end
80
+
81
81
  def _clean_options(options)
82
82
  headers = [super, _authorization_headers, _api_version_headers]
83
83
  headers.inject(&:merge)
@@ -1,15 +1,23 @@
1
1
  require 'oga'
2
2
  require 'open-uri'
3
3
  require 'json'
4
+ require 'openssl'
5
+ require 'cgi'
4
6
 
5
7
  class VideoInfo
6
8
  module Providers
7
9
  module VimeoScraper
8
10
  def author
9
- json_info['author']['name']
11
+ if available?
12
+ json_info['author']['name']
13
+ end
10
14
  end
11
15
 
12
16
  def author_thumbnail
17
+ unless available?
18
+ return nil
19
+ end
20
+
13
21
  split_point = 'window.vimeo.clip_page_config ='
14
22
  script_tags = data.css('script')
15
23
 
@@ -27,7 +35,9 @@ class VideoInfo
27
35
  end
28
36
 
29
37
  def author_url
30
- json_info['author']['url']
38
+ if available?
39
+ json_info['author']['url']
40
+ end
31
41
  end
32
42
 
33
43
  def available?
@@ -36,9 +46,9 @@ class VideoInfo
36
46
  if data.nil?
37
47
  is_available = false
38
48
  elsif is_available
39
- page_header = data.css('#page_header')
49
+ password_elements = data.css('.exception_title--password')
40
50
 
41
- if page_header.text == "\n Private Video\n "
51
+ unless password_elements.empty?
42
52
  is_available = false
43
53
  end
44
54
  end
@@ -55,16 +65,24 @@ class VideoInfo
55
65
  end
56
66
 
57
67
  def date
58
- upload_date = json_info['uploadDate']
59
- ISO8601::DateTime.new(upload_date).to_time
68
+ if available?
69
+ upload_date = json_info['uploadDate']
70
+ ISO8601::DateTime.new(upload_date).to_time
71
+ end
60
72
  end
61
73
 
62
74
  def duration
63
- duration = json_info['duration']
64
- ISO8601::Duration.new(duration).to_seconds.to_i
75
+ if available?
76
+ duration = json_info['duration']
77
+ ISO8601::Duration.new(duration).to_seconds.to_i
78
+ end
65
79
  end
66
80
 
67
81
  def keywords
82
+ unless available?
83
+ return nil
84
+ end
85
+
68
86
  if json_info['keywords']
69
87
  json_info['keywords']
70
88
  else
@@ -73,31 +91,53 @@ class VideoInfo
73
91
  end
74
92
 
75
93
  def height
76
- json_info['height']
94
+ if available?
95
+ json_info['height']
96
+ end
77
97
  end
78
98
 
79
99
  def width
80
- json_info['width']
100
+ if available?
101
+ json_info['width']
102
+ end
81
103
  end
82
104
 
83
105
  def thumbnail_small
84
- thumbnail_url.split('_')[0] + '_100x75.jpg'
106
+ if available?
107
+ thumbnail_url.split('_')[0] + '_100x75.jpg'
108
+ end
85
109
  end
86
110
 
87
111
  def thumbnail_medium
88
- thumbnail_url.split('_')[0] + '_200x150.jpg'
112
+ if available?
113
+ thumbnail_url.split('_')[0] + '_200x150.jpg'
114
+ end
89
115
  end
90
116
 
91
117
  def thumbnail_large
92
- thumbnail_url.split('_')[0] + '_640.jpg'
118
+ if available?
119
+ thumbnail_url.split('_')[0] + '_640.jpg'
120
+ end
93
121
  end
94
122
 
95
123
  def view_count
96
- json_info['interactionCount']
124
+ if available?
125
+ user_interaction_count(interaction_type: "http://schema.org/WatchAction")
126
+ end
97
127
  end
98
128
 
99
129
  private
100
130
 
131
+ def user_interaction_count(interaction_type:)
132
+ interaction_statistic.find do |stat|
133
+ stat["interactionType"] == interaction_type
134
+ end["userInteractionCount"]
135
+ end
136
+
137
+ def interaction_statistic
138
+ json_info["interactionStatistic"]
139
+ end
140
+
101
141
  def json_info
102
142
  @json_info ||= JSON.parse(data.css('script').detect do |n|
103
143
  type = n.attr('type')
@@ -111,7 +151,17 @@ class VideoInfo
111
151
  end
112
152
 
113
153
  def thumbnail_url
114
- @thumbnail_url ||= json_info['thumbnailUrl']
154
+ @thumbnail_url ||= remove_overlay(meta_node_value('og:image'))
155
+ end
156
+
157
+ def remove_overlay(url)
158
+ uri = URI.parse(url)
159
+
160
+ if uri.path == '/filter/overlay'
161
+ CGI::parse(uri.query)['src0'][0]
162
+ else
163
+ url
164
+ end
115
165
  end
116
166
 
117
167
  def meta_nodes
@@ -135,7 +185,7 @@ class VideoInfo
135
185
  end
136
186
 
137
187
  def _set_data_from_api_impl(api_url)
138
- Oga.parse_html(open(api_url.to_s).read)
188
+ Oga.parse_html(URI.open(api_url.to_s).read)
139
189
 
140
190
  rescue OpenURI::HTTPError
141
191
  nil
@@ -44,6 +44,14 @@ class VideoInfo
44
44
  "https://i.ytimg.com/vi/#{video_id}/hqdefault.jpg"
45
45
  end
46
46
 
47
+ def thumbnail_large_2x
48
+ "https://i.ytimg.com/vi/#{video_id}/sddefault.jpg"
49
+ end
50
+
51
+ def thumbnail_maxres
52
+ "https://i.ytimg.com/vi/#{video_id}/maxresdefault.jpg"
53
+ end
54
+
47
55
  private
48
56
 
49
57
  def _url_regex
@@ -58,6 +66,10 @@ class VideoInfo
58
66
  def _default_url_attributes
59
67
  {}
60
68
  end
69
+
70
+ def resize_thumb(url, size)
71
+ url.gsub(/(https:\/\/yt3.ggpht.com\/.*\/.*=s)([0-9]*)(.*)/, "\\1#{size}\\3")
72
+ end
61
73
  end
62
74
  end
63
75
  end