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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b33e589b59664cc725646602f9f4dc20466fdc7376e2d280abdc8e358c954fca
4
- data.tar.gz: edecc4f652cfa5bc6bf6850a0d2d7b618807f49a8cc8c923d5c76044cd2f053b
3
+ metadata.gz: f960d9a256e4190a6ebde694ff7f73aa630c69e82d2b76d1caed6dca392e27e0
4
+ data.tar.gz: 8b8eae4ca13fd6db5afddc9de44ceb8ae4d7a0ca2508d9da7b5dd80c76b2210a
5
5
  SHA512:
6
- metadata.gz: 76792e4998b6e08fba07d67168d049cc4e75261df446d849e4f7bc02965c8a1902e00959a4d42ff5d930d7516d86fdb722db937f2060c5d24a8ce9c0b065fb3b
7
- data.tar.gz: dc4b9426882439bb7e662043a85285528e95b0fb66c3ca2cc59c894cdf0968db3c6183ee6a8070f292bf7fc75217b7b3fe89720d8b8b717ed00a30c6b8fe2265
6
+ metadata.gz: 3806b4f8e3f44c852c2adda8183fed0cd007d18c67647b59ed702be8ae8aa64e002bb019fbf6f1d54d4d61f0410924dddfca9315a74bb982994f0f8d2392d726
7
+ data.tar.gz: c3b416a326ec07d0c692d35e8dd0be5ef3024368d2f79c41f86e5ac7595259eb16aeb59f78d74a918e8ff5b5d838c160001f1abd1b2d049226b4e6ca727ded50
@@ -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) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
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
  --------
@@ -32,6 +32,8 @@ Scrapers has been implemented for both Youtube and Vimeo. However, the Youtube s
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'
@@ -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
  ------------
@@ -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)
@@ -42,6 +43,14 @@ class VideoInfo
42
43
  end
43
44
  end
44
45
 
46
+ def thumbnail_large_2x
47
+ nil
48
+ end
49
+
50
+ def thumbnail_maxres
51
+ nil
52
+ end
53
+
45
54
  private
46
55
 
47
56
  def _response_code
@@ -101,7 +110,7 @@ class VideoInfo
101
110
  end
102
111
 
103
112
  def _set_data_from_api_impl(api_url)
104
- uri = open(api_url, options)
113
+ uri = URI.open(api_url, options)
105
114
  JSON.load(uri.read)
106
115
  end
107
116
 
@@ -1,6 +1,8 @@
1
1
  class VideoInfo
2
2
  module Providers
3
3
  module VimeoAPI
4
+ THUMBNAIL_LINK_REGEX = /.*\/(\d+\-[^_]+)/
5
+
4
6
  def api_key
5
7
  VideoInfo.provider_api_keys[:vimeo]
6
8
  end
@@ -23,7 +25,7 @@ class VideoInfo
23
25
 
24
26
  def author_thumbnail_id
25
27
  author_uri = _video['user']['pictures']['uri']
26
- @author_thumbnail_id ||= _parse_picture_id(author_uri)
28
+ @author_thumbnail_id ||= parse_picture_id_from_user(author_uri)
27
29
  end
28
30
 
29
31
  def author_url
@@ -36,7 +38,7 @@ class VideoInfo
36
38
  end
37
39
 
38
40
  def thumbnail_id
39
- @thumbnail_id ||= _parse_picture_id(_video['pictures']['uri'])
41
+ @thumbnail_id ||= parse_picture_id(_video.dig("pictures", "sizes").first["link"])
40
42
  end
41
43
 
42
44
  def thumbnail_small
@@ -111,9 +113,13 @@ class VideoInfo
111
113
  "https://#{_api_base}#{_api_path}"
112
114
  end
113
115
 
114
- def _parse_picture_id(uri)
116
+ def parse_picture_id_from_user (uri)
115
117
  %r{\/pictures\/(\d+)}.match(uri)[1]
116
118
  end
119
+
120
+ def parse_picture_id(uri)
121
+ uri.match(THUMBNAIL_LINK_REGEX)[1]
122
+ end
117
123
  end
118
124
  end
119
125
  end
@@ -122,12 +122,22 @@ class VideoInfo
122
122
 
123
123
  def view_count
124
124
  if available?
125
- json_info['interactionCount']
125
+ user_interaction_count(interaction_type: "http://schema.org/WatchAction")
126
126
  end
127
127
  end
128
128
 
129
129
  private
130
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
+
131
141
  def json_info
132
142
  @json_info ||= JSON.parse(data.css('script').detect do |n|
133
143
  type = n.attr('type')
@@ -175,7 +185,7 @@ class VideoInfo
175
185
  end
176
186
 
177
187
  def _set_data_from_api_impl(api_url)
178
- Oga.parse_html(open(api_url.to_s).read)
188
+ Oga.parse_html(URI.open(api_url.to_s).read)
179
189
 
180
190
  rescue OpenURI::HTTPError
181
191
  nil
@@ -44,6 +44,10 @@ 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
+
47
51
  def thumbnail_maxres
48
52
  "https://i.ytimg.com/vi/#{video_id}/maxresdefault.jpg"
49
53
  end
@@ -62,6 +66,10 @@ class VideoInfo
62
66
  def _default_url_attributes
63
67
  {}
64
68
  end
69
+
70
+ def resize_thumb(url, size)
71
+ url.gsub(/(https:\/\/yt3.ggpht.com\/.*\/.*=s)([0-9]*)(.*)/, "\\1#{size}\\3")
72
+ end
65
73
  end
66
74
  end
67
75
  end
@@ -83,8 +83,7 @@ class VideoInfo
83
83
 
84
84
  def _channel_info
85
85
  channel_url = _channel_api_url(_video_snippet['channelId'])
86
- @channel_data ||= open(channel_url)
87
- JSON.load(@channel_data.read)
86
+ @_channel_info ||= JSON.load(URI.open(channel_url).read)
88
87
  end
89
88
 
90
89
  def _channel_snippet
@@ -5,8 +5,12 @@ require 'net_http_timeout_errors'
5
5
  class VideoInfo
6
6
  module Providers
7
7
  module YoutubeScraper
8
+ BASE_URL = "https://www.youtube.com"
9
+ CHANNEL_URL = "#{BASE_URL}/channel/"
10
+ THUMB_DEFAULT_SIZE = 88
11
+
8
12
  def available?
9
- data.css('div#unavailable-submessage').text.strip.empty?
13
+ !!title
10
14
  end
11
15
 
12
16
  def date
@@ -16,20 +20,25 @@ class VideoInfo
16
20
  end
17
21
 
18
22
  def author
19
- data.css('.yt-user-info')[0].css('a').text
23
+ meta_node_value(channel_meta_nodes, 'og:title')
20
24
  end
21
25
 
22
26
  def author_thumbnail
23
- data.css('.yt-thumb-clip')[0].css('img').attr('data-thumb')[0].value
27
+ image_hq_url = meta_node_value(channel_meta_nodes, 'og:image')
28
+
29
+ resize_thumb(image_hq_url, THUMB_DEFAULT_SIZE)
30
+ end
31
+
32
+ def channel_id
33
+ itemprop_node_value('channelId')
24
34
  end
25
35
 
26
36
  def author_url
27
- path = data.css('.yt-user-info')[0].css('a')[0].attr('href').value
28
- 'https://www.youtube.com' + path
37
+ URI.join(CHANNEL_URL, channel_id).to_s
29
38
  end
30
39
 
31
40
  def description
32
- meta_node_value('description')
41
+ meta_node_value(video_meta_nodes, 'og:description')
33
42
  end
34
43
 
35
44
  def duration
@@ -43,45 +52,54 @@ class VideoInfo
43
52
  end
44
53
 
45
54
  def keywords
46
- value = meta_node_value('keywords')
55
+ return unless available?
56
+
57
+ value = meta_node_value(video_meta_nodes, 'keywords')
47
58
 
48
59
  value.split(', ') if value
49
60
  end
50
61
 
51
62
  def title
63
+ return if meta_node_value('title').empty?
52
64
  meta_node_value('title')
53
65
  end
54
66
 
55
67
  def view_count
56
- data.css('div.watch-view-count').text.gsub(/\D/, '').to_i
68
+ itemprop_node_value('interactionCount').to_i
57
69
  end
58
70
 
59
71
  private
60
72
 
61
- def meta_nodes
62
- @meta_nodes ||= data.css('meta')
73
+ def video_meta_nodes
74
+ @video_meta_nodes ||= data.css('meta')
63
75
  end
64
76
 
65
- def meta_node_value(name)
66
- if available?
67
- node = meta_nodes.detect do |n|
68
- n.attr('name') && n.attr('name').value == name
69
- end
77
+ def channel_meta_nodes
78
+ @channel_meta_nodes ||= channel_data.css('meta')
79
+ end
70
80
 
71
- node && node.attr('content') && node.attr('content').value
81
+ def channel_data
82
+ @channel_data ||= Oga.parse_html(URI.open(author_url).read)
83
+ end
84
+
85
+ def meta_node_value(meta_nodes=video_meta_nodes, name)
86
+ node = meta_nodes.detect do |n|
87
+ n.attr('name')&.value == name || n.attr('property')&.value == name
72
88
  end
89
+
90
+ return unless node
91
+ node && node.attr('content') && node.attr('content').value
73
92
  end
74
93
 
75
94
  def itemprop_node_value(name)
76
- if available?
77
- node = meta_nodes.detect do |m|
78
- itemprop_attr = m.attr('itemprop')
95
+ node = video_meta_nodes.detect do |m|
96
+ itemprop_attr = m.attr('itemprop')
79
97
 
80
- itemprop_attr.value == name if itemprop_attr
81
- end
82
-
83
- node.attr('content').value
98
+ itemprop_attr.value == name if itemprop_attr
84
99
  end
100
+
101
+ return unless node
102
+ node.attr('content').value
85
103
  end
86
104
 
87
105
  def _set_data_from_api_impl(api_url)
@@ -89,9 +107,9 @@ class VideoInfo
89
107
  if url.include?('.com/v/')
90
108
  video_id = url.split('/v/')[1].split('?')[0]
91
109
  new_url = 'https://www.youtube.com/watch?v=' + video_id
92
- Oga.parse_html(open(new_url).read)
110
+ Oga.parse_html(URI.open(new_url).read)
93
111
  else
94
- Oga.parse_html(open(api_url).read)
112
+ Oga.parse_html(URI.open(api_url).read)
95
113
  end
96
114
  end
97
115
 
@@ -1,5 +1,7 @@
1
1
  class VideoInfo
2
2
  module YoutubePlaylistAPI
3
+ ITEMS_MAX_RESULTS = 50
4
+
3
5
  def available?
4
6
  !data['items'].empty?
5
7
  rescue VideoInfo::HttpError
@@ -28,6 +30,10 @@ class VideoInfo
28
30
  nil
29
31
  end
30
32
 
33
+ def thumbnail
34
+ thumbnail_small
35
+ end
36
+
31
37
  def thumbnail_small
32
38
  _video_snippet['thumbnails']['default']['url']
33
39
  end
@@ -40,6 +46,14 @@ class VideoInfo
40
46
  _video_snippet['thumbnails']['high']['url']
41
47
  end
42
48
 
49
+ def thumbnail_large_2x
50
+ _video_snippet['thumbnails']['standard']['url']
51
+ end
52
+
53
+ def thumbnail_maxres
54
+ _video_snippet['thumbnails']['maxres']['url']
55
+ end
56
+
43
57
  private
44
58
 
45
59
  def _playlist_entry
@@ -56,7 +70,7 @@ class VideoInfo
56
70
 
57
71
  def _playlist_items_api_path
58
72
  '/youtube/v3/playlistItems?part=snippet&' \
59
- "playlistId=#{playlist_id}&fields=items&key=#{api_key}"
73
+ "playlistId=#{playlist_id}&fields=items&maxResults=#{ITEMS_MAX_RESULTS}&key=#{api_key}"
60
74
  end
61
75
 
62
76
  def _playlist_items_api_url
@@ -1,3 +1,3 @@
1
1
  class VideoInfo
2
- VERSION = '2.7.1'.freeze
2
+ VERSION = '3.0.2'.freeze
3
3
  end
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}" }
@@ -51,6 +50,7 @@ class VideoInfo
51
50
  :thumbnail_small,
52
51
  :thumbnail_medium,
53
52
  :thumbnail_large,
53
+ :thumbnail_large_2x,
54
54
  :thumbnail_maxres
55
55
  def_delegators :@provider, :embed_code, :embed_url
56
56
  def_delegators :@provider, :available?
@@ -0,0 +1,25 @@
1
+ 104 examples, 24 failures in 42.5583 seconds
2
+ ./spec/lib/video_info/providers/dailymotion_spec.rb:134
3
+ ./spec/lib/video_info/providers/dailymotion_spec.rb:139
4
+ ./spec/lib/video_info/providers/dailymotion_spec.rb:144
5
+ ./spec/lib/video_info/providers/dailymotion_spec.rb:159
6
+ ./spec/lib/video_info/providers/vimeo_spec.rb:108
7
+ ./spec/lib/video_info/providers/vimeo_spec.rb:115
8
+ ./spec/lib/video_info/providers/vimeo_spec.rb:120
9
+ ./spec/lib/video_info/providers/vimeo_spec.rb:128
10
+ ./spec/lib/video_info/providers/vimeo_spec.rb:133
11
+ ./spec/lib/video_info/providers/vimeo_spec.rb:138
12
+ ./spec/lib/video_info/providers/vimeo_spec.rb:143
13
+ ./spec/lib/video_info/providers/vimeo_spec.rb:152
14
+ ./spec/lib/video_info/providers/vimeo_spec.rb:158
15
+ ./spec/lib/video_info/providers/vimeo_spec.rb:164
16
+ ./spec/lib/video_info/providers/vimeo_spec.rb:180
17
+ ./spec/lib/video_info/providers/vimeo_spec.rb:197
18
+ ./spec/lib/video_info/providers/vimeo_spec.rb:202
19
+ ./spec/lib/video_info/providers/vimeo_spec.rb:207
20
+ ./spec/lib/video_info/providers/vimeo_spec.rb:212
21
+ ./spec/lib/video_info/providers/vimeo_spec.rb:308
22
+ ./spec/lib/video_info/providers/vimeo_spec.rb:309
23
+ ./spec/lib/video_info/providers/vimeo_spec.rb:310
24
+ ./spec/lib/video_info/providers/vimeo_spec.rb:311
25
+ ./spec/lib/video_info/providers/vimeo_spec.rb:54
data/video_info.gemspec CHANGED
@@ -11,21 +11,20 @@ Gem::Specification.new do |s|
11
11
  s.author = 'Thibaud Guillaume-Gentil'
12
12
  s.email = 'thibaud@thibaud.gg'
13
13
  s.homepage = 'https://rubygems.org/gems/video_info'
14
- s.summary = 'Dailymotion, Vimeo, VK and YouTube info parser.'
15
- s.description = 'Get video info from Dailymotion, Vimeo, VK and YouTube url.'
14
+ s.summary = 'Dailymotion, Vimeo and YouTube info parser.'
15
+ s.description = 'Get video info from Dailymotion, Vimeo and YouTube url.'
16
16
 
17
- s.files = `git ls-files`.split($/)
18
- s.test_files = s.files.grep(%r{^spec/})
17
+ s.files = `git ls-files`.split($/).reject { |x| x.match?(%r{^spec/}) }
19
18
  s.require_path = 'lib'
20
19
 
21
- s.required_ruby_version = '>= 2.2.0'
20
+ s.required_ruby_version = '>= 2.5.0'
22
21
 
23
22
  s.add_dependency 'iso8601', '~> 0.9.1'
24
23
  s.add_dependency 'oga', '~> 3.0'
25
24
  s.add_dependency 'net_http_timeout_errors', '~> 0.3.0'
26
25
 
27
26
  s.add_development_dependency 'bundler', '>= 1.3.5'
28
- s.add_development_dependency 'rake', '~> 11.1'
27
+ s.add_development_dependency 'rake', '>= 12.3.3'
29
28
  s.add_development_dependency 'rspec', '~> 3.4'
30
29
  s.add_development_dependency 'rspec-its', '~> 1.2'
31
30
  s.add_development_dependency 'rubocop', '~> 0.37'