video_info 2.7.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/unit_test.yml +42 -0
  3. data/Guardfile +1 -1
  4. data/README.md +8 -19
  5. data/lib/video_info/provider.rb +11 -2
  6. data/lib/video_info/providers/vimeo_api.rb +9 -3
  7. data/lib/video_info/providers/vimeo_scraper.rb +12 -2
  8. data/lib/video_info/providers/youtube.rb +8 -0
  9. data/lib/video_info/providers/youtube_api.rb +1 -2
  10. data/lib/video_info/providers/youtube_scraper.rb +43 -25
  11. data/lib/video_info/providers/youtubeplaylist_api.rb +15 -1
  12. data/lib/video_info/version.rb +1 -1
  13. data/lib/video_info.rb +3 -3
  14. data/tmp/rspec_guard_result +25 -0
  15. data/video_info.gemspec +5 -6
  16. metadata +16 -472
  17. data/.travis.yml +0 -21
  18. data/lib/video_info/providers/vkontakte.rb +0 -212
  19. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_invalid_video_url/_available_/1_2_2_1_1.yml +0 -93
  20. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -96
  21. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_author/1_3_7_1.yml +0 -100
  22. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_author_thumbnail/1_3_9_1.yml +0 -100
  23. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_author_url/1_3_8_1.yml +0 -100
  24. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_date/should_show_correct_date.yml +0 -100
  25. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_description/1_3_10_1.yml +0 -100
  26. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_duration/1_3_12_1.yml +0 -100
  27. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_keywords/1_3_11_1.yml +0 -100
  28. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail/1_3_19_1.yml +0 -100
  29. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_large/1_3_18_1.yml +0 -100
  30. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/1_3_17_1.yml +0 -100
  31. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_small/1_3_16_1.yml +0 -100
  32. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_title/1_3_6_1.yml +0 -100
  33. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_view_count/1_3_20_1.yml +0 -100
  34. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/1_2_3_1_1.yml +0 -150
  35. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/2_2_3_1_1.yml +0 -65
  36. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/1_2_2_1_1.yml +0 -124
  37. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/2_2_2_1_1.yml +0 -67
  38. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -150
  39. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/2_2_1_1_1.yml +0 -67
  40. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author/1_13_2_1.yml +0 -128
  41. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author_thumbnail/1_13_3_1.yml +0 -128
  42. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author_url/1_13_4_1.yml +0 -128
  43. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/available_/1_13_1_1.yml +0 -128
  44. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/date/1_13_7_1.yml +0 -128
  45. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/description/1_13_6_1.yml +0 -128
  46. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/duration/1_13_8_1.yml +0 -128
  47. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/height/1_13_10_1.yml +0 -128
  48. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/keywords/1_13_9_1.yml +0 -128
  49. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_large/1_13_14_1.yml +0 -128
  50. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_medium/1_13_13_1.yml +0 -128
  51. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_small/1_13_12_1.yml +0 -128
  52. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/title/1_13_5_1.yml +0 -128
  53. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/view_count/1_13_15_1.yml +0 -128
  54. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/width/1_13_11_1.yml +0 -128
  55. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/1_3_18_1.yml +0 -150
  56. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/2_3_18_1.yml +0 -79
  57. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/1_3_17_1.yml +0 -150
  58. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/2_3_17_1.yml +0 -79
  59. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/1_3_19_1.yml +0 -150
  60. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/2_3_19_1.yml +0 -79
  61. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_date/should_have_correct_upload_date.yml +0 -226
  62. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/1_3_7_1.yml +0 -150
  63. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/2_3_7_1.yml +0 -79
  64. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/1_3_9_1.yml +0 -150
  65. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/2_3_9_1.yml +0 -79
  66. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/1_3_11_1.yml +0 -150
  67. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/2_3_11_1.yml +0 -79
  68. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_keywords/should_return_a_string_list_of_keywords.yml +0 -226
  69. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail/1_3_16_1.yml +0 -222
  70. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail/2_3_16_1.yml +0 -79
  71. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/1_3_15_1.yml +0 -222
  72. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/2_3_15_1.yml +0 -79
  73. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/1_3_14_1.yml +0 -222
  74. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/2_3_14_1.yml +0 -79
  75. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/1_3_13_1.yml +0 -222
  76. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/2_3_13_1.yml +0 -79
  77. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/1_3_6_1.yml +0 -150
  78. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/2_3_6_1.yml +0 -79
  79. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/1_3_20_1.yml +0 -150
  80. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/2_3_20_1.yml +0 -79
  81. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/1_3_10_1.yml +0 -150
  82. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/2_3_10_1.yml +0 -79
  83. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail/1_12_1_1.yml +0 -222
  84. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail/2_12_1_1.yml +0 -75
  85. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail_large/1_12_2_1.yml +0 -222
  86. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail_large/2_12_2_1.yml +0 -75
  87. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail_medium/1_12_3_1.yml +0 -222
  88. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail_medium/2_12_3_1.yml +0 -75
  89. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail_small/1_12_4_1.yml +0 -222
  90. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_193970014/thumbnail_small/2_12_4_1.yml +0 -75
  91. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_hashes/available_/1_2_6_1_1.yml +0 -86
  92. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_invalid_video/available_/1_2_2_1_1.yml +0 -50
  93. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_private_video/available_/1_2_3_1_1.yml +0 -132
  94. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect/available_/1_2_4_1_1.yml +0 -134
  95. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect_to_main_page_for_auth/available_/1_2_5_1_1.yml +0 -85
  96. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_valid_video/available_/1_2_1_1_1.yml +0 -87
  97. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author/1_5_14_1.yml +0 -48
  98. 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 -48
  99. 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 -48
  100. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/description/1_5_8_1.yml +0 -48
  101. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/duration/1_5_10_1.yml +0 -48
  102. 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 -48
  103. 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 -48
  104. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/height/1_5_12_1.yml +0 -48
  105. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/thumbnail_small/1_5_18_1.yml +0 -48
  106. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/title/1_5_7_1.yml +0 -48
  107. 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 -48
  108. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/width/1_5_11_1.yml +0 -50
  109. 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 -48
  110. 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 -48
  111. 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 -48
  112. 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 -48
  113. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video-54799401_165822734/title/1_7_4_1.yml +0 -48
  114. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video3552522_171340713/embed_url/1_10_1_1.yml +0 -48
  115. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/description/1_6_8_1.yml +0 -48
  116. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/duration/1_6_10_1.yml +0 -48
  117. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/embed_code/1_6_6_1.yml +0 -48
  118. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/embed_url/1_6_5_1.yml +0 -48
  119. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/height/1_6_12_1.yml +0 -48
  120. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/title/1_6_7_1.yml +0 -48
  121. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/view_count/1_6_13_1.yml +0 -48
  122. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_161598544/width/1_6_11_1.yml +0 -48
  123. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author/1_4_5_1.yml +0 -48
  124. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_thumbnail/1_4_6_1.yml +0 -48
  125. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_url/1_4_7_1.yml +0 -48
  126. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/title/1_4_4_1.yml +0 -48
  127. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_invalid_video/_available_/1_2_2_1_1.yml +0 -67
  128. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -69
  129. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_duration/1_4_7_1.yml +0 -77
  130. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_height/1_4_9_1.yml +0 -77
  131. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_large/1_4_12_1.yml +0 -77
  132. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_medium/1_4_11_1.yml +0 -77
  133. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_small/1_4_10_1.yml +0 -77
  134. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_title/1_4_6_1.yml +0 -77
  135. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_width/1_4_8_1.yml +0 -77
  136. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_duration/1_3_7_1.yml +0 -77
  137. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_height/1_3_9_1.yml +0 -77
  138. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail/1_3_13_1.yml +0 -77
  139. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_large/1_3_12_1.yml +0 -77
  140. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_medium/1_3_11_1.yml +0 -77
  141. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_small/1_3_10_1.yml +0 -77
  142. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_title/1_3_6_1.yml +0 -77
  143. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_width/1_3_8_1.yml +0 -77
  144. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/foo/_available/1_2_2_1_1.yml +0 -1447
  145. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/foo/_available/2_2_2_1_1.yml +0 -156
  146. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/1_2_2_1_1.yml +0 -481
  147. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/1_2_3_1_1.yml +0 -485
  148. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/2_2_2_1_1.yml +0 -54
  149. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/2_2_3_1_1.yml +0 -54
  150. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/1_2_2_11_1.yml +0 -481
  151. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/1_2_3_11_1.yml +0 -481
  152. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/2_2_2_11_1.yml +0 -54
  153. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/2_2_3_11_1.yml +0 -54
  154. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/1_2_2_8_1.yml +0 -483
  155. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/1_2_3_8_1.yml +0 -483
  156. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/2_2_2_8_1.yml +0 -54
  157. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/2_2_3_8_1.yml +0 -54
  158. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/1_2_2_10_1.yml +0 -485
  159. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/1_2_3_10_1.yml +0 -484
  160. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/2_2_2_10_1.yml +0 -54
  161. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/2_2_3_10_1.yml +0 -54
  162. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/1_2_2_9_1.yml +0 -485
  163. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/1_2_3_9_1.yml +0 -484
  164. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/2_2_2_9_1.yml +0 -54
  165. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/2_2_3_9_1.yml +0 -54
  166. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/1_2_2_7_1.yml +0 -481
  167. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/1_2_3_7_1.yml +0 -484
  168. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/2_2_2_7_1.yml +0 -54
  169. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/2_2_3_7_1.yml +0 -54
  170. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_2_17_1.yml +0 -485
  171. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_3_17_1.yml +0 -485
  172. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_2_17_1.yml +0 -54
  173. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_3_17_1.yml +0 -54
  174. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/1_2_1_1_1.yml +0 -56
  175. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/2_2_1_1_1.yml +0 -125
  176. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/1_2_3_1_1.yml +0 -483
  177. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/1_2_4_1_1.yml +0 -484
  178. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/2_2_3_1_1.yml +0 -54
  179. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/2_2_4_1_1.yml +0 -54
  180. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_date/should_return_date_video_was_posted.yml +0 -178
  181. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/1_17_7_1.yml +0 -56
  182. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/2_17_7_1.yml +0 -125
  183. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/1_17_9_1.yml +0 -56
  184. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/2_17_9_1.yml +0 -125
  185. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/1_17_8_1.yml +0 -56
  186. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/2_17_8_1.yml +0 -125
  187. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/1_17_6_1.yml +0 -56
  188. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/2_17_6_1.yml +0 -125
  189. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/1_17_16_1.yml +0 -56
  190. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/2_17_16_1.yml +0 -125
  191. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/1_3_6_1.yml +0 -56
  192. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/2_3_6_1.yml +0 -125
  193. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/1_3_7_1.yml +0 -56
  194. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/2_3_7_1.yml +0 -208
  195. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/1_3_8_1.yml +0 -56
  196. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/2_3_8_1.yml +0 -208
  197. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_date/should_return_date_video_was_posted.yml +0 -178
  198. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/1_3_10_1.yml +0 -56
  199. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/2_3_10_1.yml +0 -125
  200. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/1_3_12_1.yml +0 -56
  201. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/2_3_12_1.yml +0 -125
  202. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/1_3_11_1.yml +0 -56
  203. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/2_3_11_1.yml +0 -125
  204. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/1_3_9_1.yml +0 -56
  205. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/2_3_9_1.yml +0 -125
  206. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/1_3_20_1.yml +0 -56
  207. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/2_3_20_1.yml +0 -125
  208. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/1_2_2_1_1.yml +0 -60
  209. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/2_2_2_1_1.yml +0 -60
  210. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/1_2_3_1_1.yml +0 -94
  211. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/2_2_3_1_1.yml +0 -94
  212. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/1_2_1_1_1.yml +0 -94
  213. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/2_2_1_1_1.yml +0 -94
  214. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/1_3_19_1.yml +0 -105
  215. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/2_3_19_1.yml +0 -105
  216. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/1_3_20_1.yml +0 -189
  217. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/2_3_20_1.yml +0 -189
  218. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/1_3_21_1.yml +0 -189
  219. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/2_3_21_1.yml +0 -189
  220. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/1_3_7_1.yml +0 -105
  221. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/2_3_7_1.yml +0 -105
  222. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/1_3_8_1.yml +0 -105
  223. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/2_3_8_1.yml +0 -105
  224. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail/1_3_16_1.yml +0 -105
  225. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail/2_3_16_1.yml +0 -105
  226. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/1_3_15_1.yml +0 -105
  227. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/2_3_15_1.yml +0 -105
  228. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/1_3_14_1.yml +0 -105
  229. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/2_3_14_1.yml +0 -105
  230. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/1_3_13_1.yml +0 -105
  231. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/2_3_13_1.yml +0 -105
  232. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/1_3_6_1.yml +0 -105
  233. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/2_3_6_1.yml +0 -105
  234. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_videos/returns_list_of_videos_in_playlist.yml +0 -265
  235. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/1_4_2_1.yml +0 -54
  236. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/2_4_2_1.yml +0 -54
  237. data/spec/lib/video_info/provider_spec.rb +0 -80
  238. data/spec/lib/video_info/providers/dailymotion_spec.rb +0 -194
  239. data/spec/lib/video_info/providers/vimeo_spec.rb +0 -328
  240. data/spec/lib/video_info/providers/vkontakte_spec.rb +0 -236
  241. data/spec/lib/video_info/providers/wistia_spec.rb +0 -197
  242. data/spec/lib/video_info/providers/youtube_playlist_spec.rb +0 -236
  243. data/spec/lib/video_info/providers/youtube_scraper_spec.rb +0 -12
  244. data/spec/lib/video_info/providers/youtube_spec.rb +0 -575
  245. data/spec/lib/video_info_spec.rb +0 -106
  246. data/spec/spec_helper.rb +0 -26
@@ -1,575 +0,0 @@
1
- require 'spec_helper'
2
-
3
- [nil, 'AIzaSyA6PYwSr1EnLFUFy1cZDk3Ifb0rxeJaeZ0'].each do |api_key|
4
- describe VideoInfo::Providers::Youtube do
5
- before(:all) do
6
- VideoInfo.provider_api_keys = { youtube: api_key }
7
- end
8
-
9
- describe '.usable?' do
10
- subject { VideoInfo::Providers::Youtube.usable?(url) }
11
-
12
- context 'with youtube.com url' do
13
- let(:url) { 'http://www.youtube.com/watch?v=Xp6CXF' }
14
- it { is_expected.to be_truthy }
15
- end
16
-
17
- context 'with youtu.be url' do
18
- let(:url) { 'http://youtu.be/JM9NgvjjVng' }
19
- it { is_expected.to be_truthy }
20
- end
21
-
22
- context 'with other url' do
23
- let(:url) { 'http://google.com/video1' }
24
- it { is_expected.to be_falsey }
25
- end
26
-
27
- context 'with playlist url' do
28
- let(:url) { 'http://www.youtube.com/playlist?p=PLA575C81A1FBC04CF' }
29
- it { is_expected.to be_falsey }
30
- end
31
- end
32
-
33
- describe '#available?' do
34
- context 'with valid video', :vcr do
35
- subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4'.freeze) }
36
-
37
- describe '#available?' do
38
- subject { super().available? }
39
- it { is_expected.to be_truthy }
40
- end
41
- end
42
-
43
- context 'with unavailable video', :vcr do
44
- subject { VideoInfo.new('http://www.youtube.com/watch?v=SUkXvWn1m7Q') }
45
-
46
- describe '#available?' do
47
- subject { super().available? }
48
- it { is_expected.to be_falsey }
49
- end
50
-
51
- describe '#provider' do
52
- subject { super().provider }
53
- it { is_expected.to eq 'YouTube' }
54
- end
55
-
56
- describe '#video_id' do
57
- subject { super().video_id }
58
- it { is_expected.to eq 'SUkXvWn1m7Q' }
59
- end
60
-
61
- describe '#url' do
62
- subject { super().url }
63
- it { is_expected.to eq 'http://www.youtube.com/watch?v=SUkXvWn1m7Q' }
64
- end
65
-
66
- describe '#embed_url' do
67
- subject { super().embed_url }
68
- it { is_expected.to eq '//www.youtube.com/embed/SUkXvWn1m7Q' }
69
- end
70
-
71
- describe '#embed_code' do
72
- subject { super().embed_code }
73
- embed_code = '<iframe src="//www.youtube.com/embed/SUkXvWn1m7Q" ' \
74
- 'frameborder="0" allowfullscreen="allowfullscreen">' \
75
- '</iframe>'
76
- it { is_expected.to eq embed_code }
77
- end
78
-
79
- describe '#title' do
80
- subject { super().title }
81
- it { is_expected.to eq nil }
82
- end
83
-
84
- describe '#description' do
85
- subject { super().description }
86
- it { is_expected.to eq nil }
87
- end
88
-
89
- describe '#keywords' do
90
- subject { super().keywords }
91
- it { is_expected.to be_nil }
92
- end
93
-
94
- describe '#duration' do
95
- subject { super().duration }
96
- it { is_expected.to eq 0 }
97
- end
98
-
99
- describe '#date' do
100
- subject { super().date }
101
- it { is_expected.to eq nil }
102
- end
103
-
104
- describe '#thumbnail_small' do
105
- subject { super().thumbnail_small }
106
- thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/default.jpg'
107
- it { is_expected.to eq thumbnail_url }
108
- end
109
-
110
- describe '#thumbnail_medium' do
111
- subject { super().thumbnail_medium }
112
- thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/mqdefault.jpg'
113
- it { is_expected.to eq thumbnail_url }
114
- end
115
-
116
- describe '#thumbnail_large' do
117
- subject { super().thumbnail_large }
118
- thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/hqdefault.jpg'
119
- it { is_expected.to eq thumbnail_url }
120
- end
121
-
122
- describe '#thumbnail_maxres' do
123
- subject { super().thumbnail_maxres }
124
- thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/maxresdefault.jpg'
125
- it { is_expected.to eq thumbnail_url }
126
- end
127
-
128
- describe '#thumbnail' do
129
- subject { super().thumbnail }
130
- thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/hqdefault.jpg'
131
- it { is_expected.to eq thumbnail_url }
132
- end
133
-
134
- describe '#view_count' do
135
- subject { super().view_count }
136
- it { is_expected.to be == 0 }
137
- end
138
- end
139
-
140
- context 'with video removed because of copyright claim', :vcr do
141
- subject { VideoInfo.new('http://www.youtube.com/watch?v=ffClNhwx0KU') }
142
-
143
- describe '#available?' do
144
- subject { super().available? }
145
- it { is_expected.to be_falsey }
146
- end
147
- end
148
- end
149
-
150
- context 'with video mZqGqE0D0n4', :vcr do
151
- subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
152
-
153
- describe '#provider' do
154
- subject { super().provider }
155
- it { is_expected.to eq 'YouTube' }
156
- end
157
-
158
- describe '#video_id' do
159
- subject { super().video_id }
160
- it { is_expected.to eq 'mZqGqE0D0n4' }
161
- end
162
-
163
- describe '#url' do
164
- subject { super().url }
165
- it { is_expected.to eq 'http://www.youtube.com/watch?v=mZqGqE0D0n4' }
166
- end
167
-
168
- describe '#embed_url' do
169
- subject { super().embed_url }
170
- it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
171
- end
172
-
173
- describe '#embed_code' do
174
- subject { super().embed_code }
175
- embed_code = '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" ' \
176
- 'frameborder="0" allowfullscreen="allowfullscreen">' \
177
- '</iframe>'
178
- it { is_expected.to eq embed_code }
179
- end
180
-
181
- describe '#author' do
182
- subject { super().author }
183
- it { is_expected.to eql 'Cherry Bloom' }
184
- end
185
-
186
- describe '#author_thumbnail' do
187
- subject { super().author_thumbnail }
188
- author_thumbnail = 'https://yt3.ggpht.com/-7rhnfdQaI3k/AAAAAAAAAAI/' \
189
- 'AAAAAAAAAAA/eMJZ5HBukCQ/s88-c-k-no-mo-rj-c0xffffff' \
190
- '/photo.jpg'
191
- it { is_expected.to eql author_thumbnail }
192
- end
193
-
194
- describe '#author_url' do
195
- subject { super().author_url }
196
- author_url = 'https://www.youtube.com/channel/UCzxQk-rZGowoqMBKxGD5jSA'
197
- it { is_expected.to eql author_url }
198
- end
199
-
200
- describe '#title' do
201
- subject { super().title }
202
- it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
203
- end
204
-
205
- describe '#description' do
206
- subject { super().description }
207
- description = 'The first video from the upcoming album Secret Sounds,' \
208
- ' to download in-stores April 14. ' \
209
- 'Checkout http://www.cherrybloom.net'
210
- it { is_expected.to eq description }
211
- end
212
-
213
- describe '#keywords' do
214
- subject { super().keywords }
215
- keywords_list = %w(cherry bloom king of the knife guitar
216
- drum clip rock alternative tremplin Paris-Forum)
217
- it { is_expected.to eq keywords_list }
218
- end
219
-
220
- describe '#duration' do
221
- subject { super().duration }
222
- it { is_expected.to eq 176 }
223
- end
224
-
225
- describe '#width' do
226
- subject { super().width }
227
- it { is_expected.to be_nil }
228
- end
229
-
230
- describe '#height' do
231
- subject { super().height }
232
- it { is_expected.to be_nil }
233
- end
234
-
235
- describe '#date' do
236
- subject { super().date }
237
-
238
- it 'should return date video was posted' do
239
- if api_key.nil?
240
- is_expected.to eq Time.parse('Sat Apr 12 2008', Time.now.utc)
241
- else
242
- is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008',
243
- Time.now.utc)
244
- end
245
- end
246
- end
247
-
248
- describe '#thumbnail_small' do
249
- subject { super().thumbnail_small }
250
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg'
251
- it { is_expected.to eq thumbnail_url }
252
- end
253
-
254
- describe '#thumbnail_medium' do
255
- subject { super().thumbnail_medium }
256
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg'
257
- it { is_expected.to eq thumbnail_url }
258
- end
259
-
260
- describe '#thumbnail_large' do
261
- subject { super().thumbnail_large }
262
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg'
263
- it { is_expected.to eq thumbnail_url }
264
- end
265
-
266
- describe '#thumbnail_maxres' do
267
- subject { super().thumbnail_maxres }
268
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/maxresdefault.jpg'
269
- it { is_expected.to eq thumbnail_url }
270
- end
271
-
272
- describe '#view_count' do
273
- subject { super().view_count }
274
- it { is_expected.to be > 4000 }
275
- end
276
- end
277
-
278
- context 'with video oQ49W_xKzKA', :vcr do
279
- subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
280
-
281
- it 'should properly apply arbitrary url attributes' do
282
- embed_code = subject.embed_code(url_attributes: { autoplay: 1 })
283
- expect(embed_code).to match(/autoplay=1/)
284
- end
285
- end
286
-
287
- context 'with video oQ49W_xKzKA', :vcr do
288
- subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
289
-
290
- describe '#provider' do
291
- subject { super().provider }
292
- it { is_expected.to eq 'YouTube' }
293
- end
294
-
295
- describe '#video_id' do
296
- subject { super().video_id }
297
- it { is_expected.to eq 'oQ49W_xKzKA' }
298
- end
299
- end
300
-
301
- context 'with video Xp6CXF-Cesg', :vcr do
302
- subject { VideoInfo.new('http://www.youtube.com/watch?v=Xp6CXF-Cesg') }
303
-
304
- describe '#provider' do
305
- subject { super().provider }
306
- it { is_expected.to eq 'YouTube' }
307
- end
308
-
309
- describe '#video_id' do
310
- subject { super().video_id }
311
- it { is_expected.to eq 'Xp6CXF-Cesg' }
312
- end
313
- end
314
-
315
- context 'with video VeasFckfMHY in user url', :vcr do
316
- video_url = 'http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY'
317
- subject { VideoInfo.new(video_url) }
318
-
319
- describe '#provider' do
320
- subject { super().provider }
321
- it { is_expected.to eq 'YouTube' }
322
- end
323
-
324
- describe '#video_id' do
325
- subject { super().video_id }
326
- it { is_expected.to eq 'VeasFckfMHY' }
327
- end
328
-
329
- describe '#url' do
330
- subject { super().url }
331
- it { is_expected.to eq video_url }
332
- end
333
- end
334
-
335
- context 'with video VeasFckfMHY after params', :vcr do
336
- video_url = 'http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY'
337
- subject { VideoInfo.new(video_url) }
338
-
339
- describe '#provider' do
340
- subject { super().provider }
341
- it { is_expected.to eq 'YouTube' }
342
- end
343
-
344
- describe '#video_id' do
345
- subject { super().video_id }
346
- it { is_expected.to eq 'VeasFckfMHY' }
347
- end
348
-
349
- describe '#url' do
350
- subject { super().url }
351
- it { is_expected.to eq video_url }
352
- end
353
- end
354
-
355
- context 'with video VeasFckfMHY in path', :vcr do
356
- subject { VideoInfo.new('http://www.youtube.com/v/VeasFckfMHY') }
357
-
358
- describe '#provider' do
359
- subject { super().provider }
360
- it { is_expected.to eq 'YouTube' }
361
- end
362
-
363
- describe '#video_id' do
364
- subject { super().video_id }
365
- it { is_expected.to eq 'VeasFckfMHY' }
366
- end
367
- end
368
-
369
- context 'with video VeasFckfMHY in e path', :vcr do
370
- subject { VideoInfo.new('http://www.youtube.com/e/VeasFckfMHY') }
371
-
372
- describe '#provider' do
373
- subject { super().provider }
374
- it { is_expected.to eq 'YouTube' }
375
- end
376
-
377
- describe '#video_id' do
378
- subject { super().video_id }
379
- it { is_expected.to eq 'VeasFckfMHY' }
380
- end
381
- end
382
-
383
- context 'with video VeasFckfMHY in embed path', :vcr do
384
- subject { VideoInfo.new('http://www.youtube.com/embed/VeasFckfMHY') }
385
-
386
- describe '#provider' do
387
- subject { super().provider }
388
- it { is_expected.to eq 'YouTube' }
389
- end
390
-
391
- describe '#video_id' do
392
- subject { super().video_id }
393
- it { is_expected.to eq 'VeasFckfMHY' }
394
- end
395
- end
396
-
397
- context 'with video JM9NgvjjVng in youtu.be url', :vcr do
398
- subject { VideoInfo.new('http://youtu.be/JM9NgvjjVng') }
399
-
400
- describe '#provider' do
401
- subject { super().provider }
402
- it { is_expected.to eq 'YouTube' }
403
- end
404
-
405
- describe '#video_id' do
406
- subject { super().video_id }
407
- it { is_expected.to eq 'JM9NgvjjVng' }
408
- end
409
- end
410
-
411
- context 'without http or www', :vcr do
412
- subject { VideoInfo.new('youtu.be/JM9NgvjjVng') }
413
-
414
- describe '#provider' do
415
- subject { super().provider }
416
- it { is_expected.to eq('YouTube') }
417
- end
418
-
419
- describe '#video_id' do
420
- subject { super().video_id }
421
- it { is_expected.to eq 'JM9NgvjjVng' }
422
- end
423
- end
424
-
425
- context 'with video url in text', :vcr do
426
- url_in_text = '<a href="http://www.youtube.com/watch?v=mZqGqE0D0n4">' \
427
- 'http://www.youtube.com/watch?v=mZqGqE0D0n4</a>'
428
- subject { VideoInfo.new(url_in_text) }
429
-
430
- describe '#provider' do
431
- subject { super().provider }
432
- it { is_expected.to eq('YouTube') }
433
- end
434
-
435
- describe '#video_id' do
436
- subject { super().video_id }
437
- it { is_expected.to eq('mZqGqE0D0n4') }
438
- end
439
- end
440
-
441
- context 'with iframe attributes', :vcr do
442
- subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
443
-
444
- describe '#provider' do
445
- subject { super().provider }
446
- it { is_expected.to eq('YouTube') }
447
- end
448
-
449
- it 'should properly apply dimensions attributes' do
450
- dimensions = { width: 800, height: 600 }
451
- embed_code = subject.embed_code(iframe_attributes: dimensions)
452
- expect(embed_code).to match(/width="800"/)
453
- expect(embed_code).to match(/height="600"/)
454
- end
455
- end
456
-
457
- context 'with arbitrary iframe_attributes', :vcr do
458
- subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
459
-
460
- describe '#provider' do
461
- subject { super().provider }
462
- it { is_expected.to eq('YouTube') }
463
- end
464
-
465
- it 'should properly apply arbitrary attributes' do
466
- attributes = { :'data-colorbox' => true }
467
- embed_code = subject.embed_code(iframe_attributes: attributes)
468
- expect(embed_code).to match(/data-colorbox="true"/)
469
- end
470
- end
471
-
472
- context 'with full screen video URLs', :vcr do
473
- subject { VideoInfo.new('http://www.youtube.com/v/mZqGqE0D0n4') }
474
-
475
- describe '#provider' do
476
- subject { super().provider }
477
- it { is_expected.to eq 'YouTube' }
478
- end
479
-
480
- describe '#video_id' do
481
- subject { super().video_id }
482
- it { is_expected.to eq 'mZqGqE0D0n4' }
483
- end
484
-
485
- describe '#url' do
486
- subject { super().url }
487
- it { is_expected.to eq 'http://www.youtube.com/v/mZqGqE0D0n4' }
488
- end
489
-
490
- describe '#embed_url' do
491
- subject { super().embed_url }
492
- it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
493
- end
494
-
495
- describe '#embed_code' do
496
- subject { super().embed_code }
497
- embed_code = '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" ' \
498
- 'frameborder="0" allowfullscreen="allowfullscreen">' \
499
- '</iframe>'
500
- it { is_expected.to eq embed_code }
501
- end
502
-
503
- describe '#title' do
504
- subject { super().title }
505
- it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
506
- end
507
-
508
- describe '#description' do
509
- subject { super().description }
510
- description = 'The first video from the upcoming album Secret Sounds,' \
511
- ' to download in-stores April 14. ' \
512
- 'Checkout http://www.cherrybloom.net'
513
- it { is_expected.to eq description }
514
- end
515
-
516
- describe '#keywords' do
517
- subject { super().keywords }
518
- keywords_list = %w(cherry bloom king of the knife guitar
519
- drum clip rock alternative tremplin Paris-Forum)
520
- it { is_expected.to eq keywords_list }
521
- end
522
-
523
- describe '#duration' do
524
- subject { super().duration }
525
- it { is_expected.to eq 176 }
526
- end
527
-
528
- describe '#width' do
529
- subject { super().width }
530
- it { is_expected.to be_nil }
531
- end
532
-
533
- describe '#height' do
534
- subject { super().height }
535
- it { is_expected.to be_nil }
536
- end
537
-
538
- describe '#date' do
539
- subject { super().date }
540
-
541
- it 'should return date video was posted' do
542
- if api_key.nil?
543
- is_expected.to eq Time.parse('Sat Apr 12 2008', Time.now.utc)
544
- else
545
- is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008',
546
- Time.now.utc)
547
- end
548
- end
549
- end
550
-
551
- describe '#thumbnail_small' do
552
- subject { super().thumbnail_small }
553
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg'
554
- it { is_expected.to eq thumbnail_url }
555
- end
556
-
557
- describe '#thumbnail_medium' do
558
- subject { super().thumbnail_medium }
559
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg'
560
- it { is_expected.to eq thumbnail_url }
561
- end
562
-
563
- describe '#thumbnail_large' do
564
- subject { super().thumbnail_large }
565
- thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg'
566
- it { is_expected.to eq thumbnail_url }
567
- end
568
-
569
- describe '#view_count' do
570
- subject { super().view_count }
571
- it { is_expected.to be > 4000 }
572
- end
573
- end
574
- end
575
- end
@@ -1,106 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe VideoInfo do
4
- describe '#initialize' do
5
- let(:url) { 'url' }
6
- let(:options) { { foo: :bar } }
7
- let(:provider) { double('provider', provider: 'Provider') }
8
-
9
- it 'uses the first usable provider' do
10
- allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
11
- allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
12
- allow(VideoInfo::Providers::Youtube).to receive(:usable?) { true }
13
- allow(VideoInfo::Providers::Youtube).to receive(:new) { provider }
14
-
15
- expect(VideoInfo.new(url, options).provider).to eq 'Provider'
16
- end
17
-
18
- it 'raise when no providers are usable' do
19
- allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
20
- allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
21
- allow(VideoInfo::Providers::Youtube).to receive(:usable?) { false }
22
-
23
- expect { VideoInfo.new(url, options) }.to raise_error(VideoInfo::UrlError)
24
- end
25
- end
26
-
27
- describe '.disable_providers' do
28
- let(:youtube_url) { 'https://www.youtube.com/watch?v=mZqGqE0D0n4' }
29
- let(:vimeo_url) { 'http://vimeo.com/86701482' }
30
-
31
- it 'does not attempt to use a provider marked as disabled' do
32
- VideoInfo.disable_providers = %w[YouTube Vimeo]
33
-
34
- expect { VideoInfo.new(youtube_url) }.to raise_error(VideoInfo::UrlError)
35
- expect { VideoInfo.new(vimeo_url) }.to raise_error(VideoInfo::UrlError)
36
-
37
- VideoInfo.disable_providers = []
38
- end
39
-
40
- it 'is case insensitive' do
41
- VideoInfo.disable_providers = %w[youTUBe VIMEO]
42
-
43
- expect { VideoInfo.new(youtube_url) }.to raise_error(VideoInfo::UrlError)
44
- expect { VideoInfo.new(vimeo_url) }.to raise_error(VideoInfo::UrlError)
45
-
46
- VideoInfo.disable_providers = []
47
- end
48
- end
49
-
50
- describe '.usable?' do
51
- let(:url) { 'url' }
52
- let(:provider) { double('provider', new: true) }
53
-
54
- it 'returns true when a provider is usable' do
55
- allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
56
- allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
57
- allow(VideoInfo::Providers::Youtube).to receive(:usable?) { true }
58
- allow(VideoInfo::Providers::Youtube).to receive(:new) { true }
59
-
60
- expect(VideoInfo.usable?(url)).to be_truthy
61
- end
62
-
63
- it 'returns false when no providers are usable' do
64
- allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
65
- allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
66
- allow(VideoInfo::Providers::Youtube).to receive(:usable?) { false }
67
-
68
- expect(VideoInfo.usable?(url)).to be_falsey
69
- end
70
- end
71
-
72
- describe '.provider_api_keys' do
73
- it 'raises an error if key is not a symbol' do
74
- expected_error = expect do
75
- VideoInfo.provider_api_keys = { 'Youtube' => 'key' }
76
- end
77
-
78
- expected_error.to raise_error(ArgumentError)
79
-
80
- expected = expect do
81
- VideoInfo.provider_api_keys = { youtube: 'key' }
82
- end
83
-
84
- expected.to_not raise_error
85
- end
86
- end
87
-
88
- describe '#==' do
89
- let(:vi_a) { VideoInfo.new('http://www.youtube.com/watch?v=AT_5xOGh6Ko') }
90
- let(:vi_b) { VideoInfo.new('http://www.youtube.com/watch?v=AT_5xOGh6Ko') }
91
- let(:vi_c) { VideoInfo.new('http://vimeo.com/86701482') }
92
-
93
- context 'matching' do
94
- it 'returns true' do
95
- expect(vi_a == vi_b).to be_truthy
96
- end
97
- end
98
-
99
- context 'not matching' do
100
- it 'returns false' do
101
- expect(vi_a == vi_c).to be_falsey
102
- expect(vi_b == vi_c).to be_falsey
103
- end
104
- end
105
- end
106
- end
data/spec/spec_helper.rb DELETED
@@ -1,26 +0,0 @@
1
- require 'rspec'
2
- require 'rspec/its'
3
- require 'video_info'
4
- require 'vcr'
5
-
6
- if ENV['CI']
7
- require 'coveralls'
8
- Coveralls.wear!
9
- end
10
-
11
- VCR.configure do |config|
12
- config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
13
- config.default_cassette_options = {
14
- record: :new_episodes,
15
- re_record_interval: 7 * 24 * 60 * 60
16
- }
17
-
18
- config.allow_http_connections_when_no_cassette = true
19
- config.hook_into :webmock
20
- config.configure_rspec_metadata!
21
- end
22
-
23
- RSpec.configure do |config|
24
- config.filter_run focus: true
25
- config.run_all_when_everything_filtered = true
26
- end