video_info 2.6.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/unit_test.yml +39 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +242 -1
- data/CONTRIBUTING.md +11 -0
- data/Gemfile +1 -1
- data/Guardfile +2 -2
- data/README.md +29 -7
- data/lib/video_info.rb +25 -28
- data/lib/video_info/provider.rb +25 -12
- data/lib/video_info/providers/dailymotion.rb +19 -3
- data/lib/video_info/providers/vimeo.rb +3 -3
- data/lib/video_info/providers/vimeo_api.rb +20 -11
- data/lib/video_info/providers/vimeo_scraper.rb +93 -23
- data/lib/video_info/providers/wistia.rb +2 -1
- data/lib/video_info/providers/youtube.rb +16 -2
- data/lib/video_info/providers/youtube_api.rb +42 -8
- data/lib/video_info/providers/youtube_scraper.rb +64 -31
- data/lib/video_info/providers/youtubeplaylist.rb +5 -2
- data/lib/video_info/providers/youtubeplaylist_api.rb +22 -1
- data/lib/video_info/providers/youtubeplaylist_scraper.rb +16 -3
- data/lib/video_info/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_invalid_video_url/_available_/1_2_2_1_1.yml +82 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_valid_video/_available_/1_2_1_1_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_author/1_3_7_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_author_thumbnail/1_3_9_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_author_url/1_3_8_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_date/should_show_correct_date.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_description/1_3_10_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_duration/1_3_12_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_keywords/1_3_11_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail/1_3_21_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_large/1_3_18_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/1_3_17_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_small/1_3_16_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_title/1_3_6_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_view_count/1_3_22_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/1_2_3_1_1.yml +151 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/2_2_3_1_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/1_2_2_1_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/2_2_2_1_1.yml +70 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/1_2_1_1_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/2_2_1_1_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author/1_13_2_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author_thumbnail/1_13_3_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author_url/1_13_4_1.yml +132 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/available_/1_13_1_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/date/1_13_7_1.yml +128 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/description/1_13_6_1.yml +131 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/duration/1_13_8_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/height/1_13_10_1.yml +131 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/keywords/1_13_9_1.yml +128 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_large/1_13_14_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_medium/1_13_13_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_small/1_13_12_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/title/1_13_5_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/view_count/1_13_15_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/width/1_13_11_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/1_3_20_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/2_3_20_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/1_3_19_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/2_3_19_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/1_3_21_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/2_3_21_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_date/should_have_correct_upload_date.yml +240 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/1_3_7_1.yml +160 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/2_3_7_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/1_3_9_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/2_3_9_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/1_3_11_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/2_3_11_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_keywords/should_return_a_string_list_of_keywords.yml +240 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail/1_3_18_1.yml +236 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail/2_3_18_1.yml +82 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/1_3_15_1.yml +236 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/2_3_15_1.yml +82 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/1_3_14_1.yml +235 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/2_3_14_1.yml +84 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/1_3_13_1.yml +236 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/2_3_13_1.yml +84 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/1_3_6_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/2_3_6_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/1_3_22_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/2_3_22_1.yml +84 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/1_3_10_1.yml +156 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/2_3_10_1.yml +82 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail/1_12_1_1.yml +234 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail/2_12_1_1.yml +78 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_large/1_12_2_1.yml +233 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_large/2_12_2_1.yml +78 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_medium/1_12_3_1.yml +235 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_medium/2_12_3_1.yml +73 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_small/1_12_4_1.yml +234 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_small/2_12_4_1.yml +77 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_invalid_video/_available_/1_2_2_1_1.yml +75 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_valid_video/_available_/1_2_1_1_1.yml +79 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_duration/1_4_7_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_height/1_4_9_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_large/1_4_12_1.yml +86 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_medium/1_4_11_1.yml +86 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_small/1_4_10_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_title/1_4_6_1.yml +86 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_width/1_4_8_1.yml +86 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_duration/1_3_7_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_height/1_3_9_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail/1_3_15_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_large/1_3_12_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_medium/1_3_11_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_small/1_3_10_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_title/1_3_6_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_width/1_3_8_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/1_2_2_1_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/2_2_2_1_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/1_2_2_11_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/2_2_2_11_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/1_2_2_8_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/2_2_2_8_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/1_2_2_10_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/2_2_2_10_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/1_2_2_9_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/2_2_2_9_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/1_2_2_7_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/2_2_2_7_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_2_18_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_2_18_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/1_2_1_1_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/2_2_1_1_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/1_2_3_1_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/2_2_3_1_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_a_video_without_description/_description/1_1_1_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_date/should_return_date_video_was_posted.yml +249 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/1_17_7_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/2_17_7_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/1_17_9_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/2_17_9_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/1_17_8_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/2_17_8_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/1_17_6_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/2_17_6_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/1_17_17_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/2_17_17_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/1_3_6_1.yml +115 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/2_3_6_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/1_3_7_1.yml +115 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/2_3_7_1.yml +335 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/1_3_8_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/2_3_8_1.yml +335 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/can_be_called_twice_and_receive_the_same_value.yml +391 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_date/should_return_date_video_was_posted.yml +243 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/1_3_10_1.yml +60 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/2_3_10_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/1_3_12_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/2_3_12_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/1_3_11_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/2_3_11_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/1_3_9_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/2_3_9_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/1_3_21_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/2_3_21_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/1_2_2_1_1.yml +120 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/1_2_3_1_1.yml +154 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/1_2_1_1_1.yml +154 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/1_3_21_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/1_3_22_1.yml +274 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/1_3_23_1.yml +274 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/1_3_7_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/1_3_8_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail/1_3_18_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/1_3_15_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large_2x/1_3_16_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_maxres/1_3_17_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/1_3_14_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/1_3_13_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/1_3_6_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_videos/returns_list_of_videos_in_playlist.yml +112 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/1_4_2_1.yml +114 -0
- data/spec/lib/video_info/provider_spec.rb +42 -22
- data/spec/lib/video_info/providers/dailymotion_spec.rb +75 -27
- data/spec/lib/video_info/providers/vimeo_spec.rb +270 -174
- data/spec/lib/video_info/providers/wistia_spec.rb +59 -20
- data/spec/lib/video_info/providers/youtube_playlist_spec.rb +97 -41
- data/spec/lib/video_info/providers/youtube_scraper_spec.rb +14 -0
- data/spec/lib/video_info/providers/youtube_spec.rb +441 -384
- data/spec/lib/video_info_spec.rb +27 -25
- data/spec/spec_helper.rb +6 -1
- data/tmp/rspec_guard_result +25 -0
- data/video_info.gemspec +11 -14
- metadata +358 -100
- data/.travis.yml +0 -13
- data/foo.txt +0 -33
- data/lib/video_info/providers/vkontakte.rb +0 -170
- data/spec/lib/video_info/providers/vimeo_api_spec.rb +0 -242
- data/spec/lib/video_info/providers/vkontakte_spec.rb +0 -173
- data/spec/lib/video_info/providers/youtube_api_spec.rb +0 -476
- data/spec/lib/video_info/providers/youtube_playlist_api_spec.rb +0 -187
@@ -1,173 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'webmock/rspec'
|
4
|
-
|
5
|
-
describe VideoInfo::Providers::Vkontakte do
|
6
|
-
|
7
|
-
describe ".usable?" do
|
8
|
-
subject { VideoInfo::Providers::Vkontakte.usable?(url) }
|
9
|
-
|
10
|
-
context "with vkontakte url" do
|
11
|
-
context "old style", :vcr do
|
12
|
-
let(:url) { 'http://vk.com/video39576223_108370515' }
|
13
|
-
it { should be_truthy }
|
14
|
-
end
|
15
|
-
|
16
|
-
context "new style", :vcr do
|
17
|
-
let(:url) { 'https://vk.com/kirill.lyanoi?z=video2152699_168591741%2F56fd229a9dfe2dcdbe' }
|
18
|
-
it { should be_truthy }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "with other url" do
|
23
|
-
let(:url) { 'http://www.youtube.com/898029' }
|
24
|
-
it { should be_falsey }
|
25
|
-
end
|
26
|
-
|
27
|
-
context "with invalid url" do
|
28
|
-
let(:url) { 'http://vk.com just random data' }
|
29
|
-
it { should be_falsey }
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with spaces at end" do
|
33
|
-
let(:url) { 'http://vk.com/video39576223_108370515 ' }
|
34
|
-
it { should be_truthy }
|
35
|
-
end
|
36
|
-
|
37
|
-
context "with spaces at start" do
|
38
|
-
let(:url) { ' http://vk.com/video39576223_108370515' }
|
39
|
-
it { should be_truthy }
|
40
|
-
end
|
41
|
-
|
42
|
-
context "with spaces around url" do
|
43
|
-
let(:url) { ' http://vk.com/video39576223_108370515 ' }
|
44
|
-
it { should be_truthy }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "#available?" do
|
49
|
-
context "with valid video", :vcr do
|
50
|
-
subject { VideoInfo.new('http://vk.com/video39576223_108370515') }
|
51
|
-
its(:available?) { should be_truthy }
|
52
|
-
end
|
53
|
-
|
54
|
-
context "with invalid video", :vcr do
|
55
|
-
subject { VideoInfo.new('http://vk.com/video39576223_invalid') }
|
56
|
-
its(:available?) { should be_falsey }
|
57
|
-
end
|
58
|
-
|
59
|
-
context "with private video", :vcr do
|
60
|
-
subject { VideoInfo.new('http://vk.com/video39576223_166315543') }
|
61
|
-
its(:available?) { should be_falsey }
|
62
|
-
end
|
63
|
-
|
64
|
-
context "with redirect", :vcr do
|
65
|
-
subject { VideoInfo.new('http://vk.com/polinka_zh?z=video186965901_168185427%2Fbfb2bd2e674031520a') }
|
66
|
-
its(:available?) { should be_truthy }
|
67
|
-
end
|
68
|
-
|
69
|
-
context "with redirect to main page for auth", :vcr do
|
70
|
-
subject { VideoInfo.new('http://vk.com/video?z=video1472940_169081944%2Falbum1472940') }
|
71
|
-
its(:available?) { should be_falsey }
|
72
|
-
end
|
73
|
-
|
74
|
-
context "with hashes", :vcr do
|
75
|
-
subject { VideoInfo.new('https://vk.com/videos43640822#/video43640822_168790809') }
|
76
|
-
its(:available?) { should be_truthy }
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
context "with video https://vk.com/id44052340?z=video61291456_159590018%2F2521d92730a272a9ea", :vcr do
|
82
|
-
subject { VideoInfo.new('https://vk.com/id44052340?z=video61291456_159590018%2F2521d92730a272a9ea') }
|
83
|
-
|
84
|
-
its(:provider) { should eq 'Vkontakte' }
|
85
|
-
its(:video_owner) { should eq '61291456' }
|
86
|
-
its(:video_id) { should eq '159590018' }
|
87
|
-
its(:title) { should eq 'Happy Birthday To You' }
|
88
|
-
its(:embed_url) { should eq '//vk.com/video_ext.php?oid=61291456&id=159590018&hash=68174b2af560c54c' }
|
89
|
-
its(:embed_code) { should eq '<iframe src="//vk.com/video_ext.php?oid=61291456&id=159590018&hash=68174b2af560c54c" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
90
|
-
end
|
91
|
-
|
92
|
-
context "with video videos43640822#/video43640822_168790809", :vcr do
|
93
|
-
subject { VideoInfo.new('https://vk.com/videos43640822#/video43640822_168790809') }
|
94
|
-
|
95
|
-
its(:provider) { should eq 'Vkontakte' }
|
96
|
-
its(:video_owner) { should eq '43640822' }
|
97
|
-
its(:video_id) { should eq '168790809' }
|
98
|
-
its(:title) { should eq 'UDC open cup 2014/ 3 place / Saley Daria (solo)' }
|
99
|
-
end
|
100
|
-
|
101
|
-
context "with video kirill.lyanoi?z=video2152699_168591741%2F56fd229a9dfe2dcdbe", :vcr do
|
102
|
-
subject { VideoInfo.new('https://vk.com/kirill.lyanoi?z=video2152699_168591741%2F56fd229a9dfe2dcdbe') }
|
103
|
-
|
104
|
-
its(:provider) { should eq 'Vkontakte' }
|
105
|
-
its(:video_owner) { should eq '2152699' }
|
106
|
-
its(:video_id) { should eq '168591741' }
|
107
|
-
its(:url) { should eq 'https://vk.com/kirill.lyanoi?z=video2152699_168591741%2F56fd229a9dfe2dcdbe' }
|
108
|
-
its(:embed_url) { should eq '//vk.com/video_ext.php?oid=2152699&id=168591741&hash=' }
|
109
|
-
its(:embed_code) { should eq '<iframe src="//vk.com/video_ext.php?oid=2152699&id=168591741&hash=" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
110
|
-
its(:title) { should eq 'BEAT SOUL STEP — RDC14 Project818 Russian Dance Championship, May 1-2, Moscow 2014' }
|
111
|
-
its(:description) { should start_with 'BEAT SOUL STEP ★ Project818 Russian Dance Championship ★ 1-2 мая, Москва 2014' }
|
112
|
-
its(:keywords) { should start_with 'BEAT SOUL STEP ★ Project818 Russian Dance Championship ★ 1-2 мая, Москва 2014' }
|
113
|
-
its(:duration) { should eq 299 }
|
114
|
-
its(:width) { should eq 0 }
|
115
|
-
its(:height) { should eq 0 }
|
116
|
-
its(:view_count) { should be > 10 }
|
117
|
-
end
|
118
|
-
|
119
|
-
context "with video video39576223_108370515", :vcr do
|
120
|
-
subject { VideoInfo.new('http://vk.com/video39576223_108370515') }
|
121
|
-
|
122
|
-
its(:provider) { should eq 'Vkontakte' }
|
123
|
-
its(:video_owner) { should eq '39576223' }
|
124
|
-
its(:video_id) { should eq '108370515' }
|
125
|
-
its(:url) { should eq 'http://vk.com/video39576223_108370515' }
|
126
|
-
its(:embed_url) { should eq '//vk.com/video_ext.php?oid=39576223&id=108370515&hash=15184dbd085c47af' }
|
127
|
-
its(:embed_code) { should eq '<iframe src="//vk.com/video_ext.php?oid=39576223&id=108370515&hash=15184dbd085c47af" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
128
|
-
its(:title) { should eq 'Я уточка)))))' }
|
129
|
-
its(:description) { should eq 'это ВЗРЫВ МОЗГА!!!<br>Просто отвал башки...' }
|
130
|
-
its(:keywords) { should eq 'это ВЗРЫВ МОЗГА!!!<br>Просто отвал башки...' }
|
131
|
-
its(:duration) { should eq 183 }
|
132
|
-
its(:width) { should eq 320 }
|
133
|
-
its(:height) { should eq 240 }
|
134
|
-
its(:view_count) { should be > 10 }
|
135
|
-
end
|
136
|
-
|
137
|
-
context "with video video-54799401_165822734", :vcr do
|
138
|
-
subject { VideoInfo.new('http://vk.com/video-54799401_165822734') }
|
139
|
-
|
140
|
-
its(:provider) { should eq 'Vkontakte' }
|
141
|
-
its(:video_owner) { should eq '-54799401' }
|
142
|
-
its(:video_id) { should eq '165822734' }
|
143
|
-
its(:title) { should eq 'SpaceGlasses are the future of computing' }
|
144
|
-
end
|
145
|
-
|
146
|
-
context 'with valid video and connection timeout' do
|
147
|
-
subject { VideoInfo.new('http://vk.com/video-54799401_165822734') }
|
148
|
-
|
149
|
-
describe '#title' do
|
150
|
-
before do
|
151
|
-
stub_request(:any, /.*vk.com.*/).to_timeout
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'raises VideoInfo::HttpError exception' do
|
155
|
-
expect { subject.title }.to raise_error VideoInfo::HttpError
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
context 'with valid video and OpenURI::HTTPError exception' do
|
161
|
-
subject { VideoInfo.new('http://vk.com/video-54799401_165822734') }
|
162
|
-
|
163
|
-
describe '#title' do
|
164
|
-
before do
|
165
|
-
stub_request(:any, /.*vk.com.*/).to_raise(OpenURI::HTTPError.new('error', :nop))
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'raises VideoInfo::HttpError exception' do
|
169
|
-
expect { subject.title }.to raise_error VideoInfo::HttpError
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
@@ -1,476 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe VideoInfo::Providers::Youtube do
|
4
|
-
before(:all) do
|
5
|
-
VideoInfo.provider_api_keys = { youtube: 'AIzaSyA6PYwSr1EnLFUFy1cZDk3Ifb0rxeJaeZ0' }
|
6
|
-
end
|
7
|
-
|
8
|
-
describe ".usable?" do
|
9
|
-
subject { VideoInfo::Providers::Youtube.usable?(url) }
|
10
|
-
|
11
|
-
context "with youtube.com url" do
|
12
|
-
let(:url) { 'http://www.youtube.com/watch?v=Xp6CXF' }
|
13
|
-
it { is_expected.to be_truthy }
|
14
|
-
end
|
15
|
-
|
16
|
-
context "with youtu.be url" do
|
17
|
-
let(:url) { 'http://youtu.be/JM9NgvjjVng' }
|
18
|
-
it { is_expected.to be_truthy }
|
19
|
-
end
|
20
|
-
|
21
|
-
context "with other url" do
|
22
|
-
let(:url) { 'http://google.com/video1' }
|
23
|
-
it { is_expected.to be_falsey }
|
24
|
-
end
|
25
|
-
|
26
|
-
context "with playlist url" do
|
27
|
-
let(:url) { 'http://www.youtube.com/playlist?p=PLA575C81A1FBC04CF' }
|
28
|
-
it { is_expected.to be_falsey }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "#available?" do
|
33
|
-
context "with valid video", :vcr do
|
34
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
35
|
-
|
36
|
-
describe '#available?' do
|
37
|
-
subject { super().available? }
|
38
|
-
it { is_expected.to be_truthy }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "with 'video is unavailable' video", :vcr do
|
43
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=SUkXvWn1m7Q') }
|
44
|
-
|
45
|
-
describe '#available?' do
|
46
|
-
subject { super().available? }
|
47
|
-
it { is_expected.to be_falsey }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#provider' do
|
51
|
-
subject { super().provider }
|
52
|
-
it { is_expected.to eq 'YouTube' }
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#video_id' do
|
56
|
-
subject { super().video_id }
|
57
|
-
it { is_expected.to eq 'SUkXvWn1m7Q' }
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#url' do
|
61
|
-
subject { super().url }
|
62
|
-
it { is_expected.to eq 'http://www.youtube.com/watch?v=SUkXvWn1m7Q' }
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#embed_url' do
|
66
|
-
subject { super().embed_url }
|
67
|
-
it { is_expected.to eq '//www.youtube.com/embed/SUkXvWn1m7Q' }
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#embed_code' do
|
71
|
-
subject { super().embed_code }
|
72
|
-
it { is_expected.to eq '<iframe src="//www.youtube.com/embed/SUkXvWn1m7Q" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
73
|
-
end
|
74
|
-
|
75
|
-
describe '#title' do
|
76
|
-
subject { super().title }
|
77
|
-
it { is_expected.to eq nil }
|
78
|
-
end
|
79
|
-
|
80
|
-
describe '#description' do
|
81
|
-
subject { super().description }
|
82
|
-
it { is_expected.to eq nil }
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '#keywords' do
|
86
|
-
subject { super().keywords }
|
87
|
-
it { is_expected.to be_nil }
|
88
|
-
end
|
89
|
-
|
90
|
-
describe '#duration' do
|
91
|
-
subject { super().duration }
|
92
|
-
it { is_expected.to eq 0 }
|
93
|
-
end
|
94
|
-
|
95
|
-
describe '#date' do
|
96
|
-
subject { super().date }
|
97
|
-
it { is_expected.to eq nil }
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '#thumbnail_small' do
|
101
|
-
subject { super().thumbnail_small }
|
102
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/SUkXvWn1m7Q/default.jpg' }
|
103
|
-
end
|
104
|
-
|
105
|
-
describe '#thumbnail_medium' do
|
106
|
-
subject { super().thumbnail_medium }
|
107
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/SUkXvWn1m7Q/mqdefault.jpg' }
|
108
|
-
end
|
109
|
-
|
110
|
-
describe '#thumbnail_large' do
|
111
|
-
subject { super().thumbnail_large }
|
112
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/SUkXvWn1m7Q/hqdefault.jpg' }
|
113
|
-
end
|
114
|
-
|
115
|
-
describe '#view_count' do
|
116
|
-
subject { super().view_count }
|
117
|
-
it { is_expected.to be == 0 }
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "with 'video no longer available due to a copyright claim' video", :vcr do
|
122
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=ffClNhwx0KU') }
|
123
|
-
|
124
|
-
describe '#available?' do
|
125
|
-
subject { super().available? }
|
126
|
-
it { is_expected.to be_truthy }
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
context "with video mZqGqE0D0n4", :vcr do
|
132
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
133
|
-
|
134
|
-
describe '#provider' do
|
135
|
-
subject { super().provider }
|
136
|
-
it { is_expected.to eq 'YouTube' }
|
137
|
-
end
|
138
|
-
|
139
|
-
describe '#video_id' do
|
140
|
-
subject { super().video_id }
|
141
|
-
it { is_expected.to eq 'mZqGqE0D0n4' }
|
142
|
-
end
|
143
|
-
|
144
|
-
describe '#url' do
|
145
|
-
subject { super().url }
|
146
|
-
it { is_expected.to eq 'http://www.youtube.com/watch?v=mZqGqE0D0n4' }
|
147
|
-
end
|
148
|
-
|
149
|
-
describe '#embed_url' do
|
150
|
-
subject { super().embed_url }
|
151
|
-
it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
|
152
|
-
end
|
153
|
-
|
154
|
-
describe '#embed_code' do
|
155
|
-
subject { super().embed_code }
|
156
|
-
it { is_expected.to eq '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
157
|
-
end
|
158
|
-
|
159
|
-
describe '#title' do
|
160
|
-
subject { super().title }
|
161
|
-
it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
|
162
|
-
end
|
163
|
-
|
164
|
-
describe '#description' do
|
165
|
-
subject { super().description }
|
166
|
-
it { is_expected.to eq 'The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net' }
|
167
|
-
end
|
168
|
-
|
169
|
-
describe '#keywords' do
|
170
|
-
subject { super().keywords }
|
171
|
-
it { is_expected.to eq %w(cherry bloom king of the knife guitar drum clip rock alternative tremplin Paris-Forum) }
|
172
|
-
end
|
173
|
-
|
174
|
-
describe '#duration' do
|
175
|
-
subject { super().duration }
|
176
|
-
it { is_expected.to eq 176 }
|
177
|
-
end
|
178
|
-
|
179
|
-
describe '#width' do
|
180
|
-
subject { super().width }
|
181
|
-
it { is_expected.to be_nil }
|
182
|
-
end
|
183
|
-
|
184
|
-
describe '#height' do
|
185
|
-
subject { super().height }
|
186
|
-
it { is_expected.to be_nil }
|
187
|
-
end
|
188
|
-
|
189
|
-
describe '#date' do
|
190
|
-
subject { super().date }
|
191
|
-
it { is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008', Time.now.utc) }
|
192
|
-
end
|
193
|
-
|
194
|
-
describe '#thumbnail_small' do
|
195
|
-
subject { super().thumbnail_small }
|
196
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg' }
|
197
|
-
end
|
198
|
-
|
199
|
-
describe '#thumbnail_medium' do
|
200
|
-
subject { super().thumbnail_medium }
|
201
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg' }
|
202
|
-
end
|
203
|
-
|
204
|
-
describe '#thumbnail_large' do
|
205
|
-
subject { super().thumbnail_large }
|
206
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg' }
|
207
|
-
end
|
208
|
-
|
209
|
-
describe '#view_count' do
|
210
|
-
subject { super().view_count }
|
211
|
-
it { is_expected.to be > 4000 }
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
context "with video oQ49W_xKzKA", :vcr do
|
216
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
|
217
|
-
|
218
|
-
it { expect(subject.embed_code(url_attributes: { autoplay: 1 })).to match(/autoplay=1/) }
|
219
|
-
end
|
220
|
-
|
221
|
-
context "with video oQ49W_xKzKA", :vcr do
|
222
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
|
223
|
-
|
224
|
-
describe '#provider' do
|
225
|
-
subject { super().provider }
|
226
|
-
it { is_expected.to eq 'YouTube' }
|
227
|
-
end
|
228
|
-
|
229
|
-
describe '#video_id' do
|
230
|
-
subject { super().video_id }
|
231
|
-
it { is_expected.to eq 'oQ49W_xKzKA' }
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
context "with video Xp6CXF-Cesg", :vcr do
|
236
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=Xp6CXF-Cesg') }
|
237
|
-
|
238
|
-
describe '#provider' do
|
239
|
-
subject { super().provider }
|
240
|
-
it { is_expected.to eq 'YouTube' }
|
241
|
-
end
|
242
|
-
|
243
|
-
describe '#video_id' do
|
244
|
-
subject { super().video_id }
|
245
|
-
it { is_expected.to eq 'Xp6CXF-Cesg' }
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
context "with video VeasFckfMHY in user url", :vcr do
|
250
|
-
subject { VideoInfo.new('http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY') }
|
251
|
-
|
252
|
-
describe '#provider' do
|
253
|
-
subject { super().provider }
|
254
|
-
it { is_expected.to eq 'YouTube' }
|
255
|
-
end
|
256
|
-
|
257
|
-
describe '#video_id' do
|
258
|
-
subject { super().video_id }
|
259
|
-
it { is_expected.to eq 'VeasFckfMHY' }
|
260
|
-
end
|
261
|
-
|
262
|
-
describe '#url' do
|
263
|
-
subject { super().url }
|
264
|
-
it { is_expected.to eq 'http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY' }
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
context "with video VeasFckfMHY after params", :vcr do
|
269
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY') }
|
270
|
-
|
271
|
-
describe '#provider' do
|
272
|
-
subject { super().provider }
|
273
|
-
it { is_expected.to eq 'YouTube' }
|
274
|
-
end
|
275
|
-
|
276
|
-
describe '#video_id' do
|
277
|
-
subject { super().video_id }
|
278
|
-
it { is_expected.to eq 'VeasFckfMHY' }
|
279
|
-
end
|
280
|
-
|
281
|
-
describe '#url' do
|
282
|
-
subject { super().url }
|
283
|
-
it { is_expected.to eq 'http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY' }
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
context "with video VeasFckfMHY in path", :vcr do
|
288
|
-
subject { VideoInfo.new('http://www.youtube.com/v/VeasFckfMHY') }
|
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 'VeasFckfMHY' }
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
context "with video VeasFckfMHY in e path", :vcr do
|
302
|
-
subject { VideoInfo.new('http://www.youtube.com/e/VeasFckfMHY') }
|
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 'VeasFckfMHY' }
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
context "with video VeasFckfMHY in embed path", :vcr do
|
316
|
-
subject { VideoInfo.new('http://www.youtube.com/embed/VeasFckfMHY') }
|
317
|
-
|
318
|
-
describe '#provider' do
|
319
|
-
subject { super().provider }
|
320
|
-
it { is_expected.to eq 'YouTube' }
|
321
|
-
end
|
322
|
-
|
323
|
-
describe '#video_id' do
|
324
|
-
subject { super().video_id }
|
325
|
-
it { is_expected.to eq 'VeasFckfMHY' }
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
context "with video JM9NgvjjVng in youtu.be url", :vcr do
|
330
|
-
subject { VideoInfo.new('http://youtu.be/JM9NgvjjVng') }
|
331
|
-
|
332
|
-
describe '#provider' do
|
333
|
-
subject { super().provider }
|
334
|
-
it { is_expected.to eq 'YouTube' }
|
335
|
-
end
|
336
|
-
|
337
|
-
describe '#video_id' do
|
338
|
-
subject { super().video_id }
|
339
|
-
it { is_expected.to eq 'JM9NgvjjVng' }
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
context 'without http or www', :vcr do
|
344
|
-
subject { VideoInfo.new('youtu.be/JM9NgvjjVng') }
|
345
|
-
|
346
|
-
describe '#provider' do
|
347
|
-
subject { super().provider }
|
348
|
-
it { is_expected.to eq('YouTube') }
|
349
|
-
end
|
350
|
-
|
351
|
-
describe '#video_id' do
|
352
|
-
subject { super().video_id }
|
353
|
-
it { is_expected.to eq 'JM9NgvjjVng' }
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
context "with video url in text", :vcr do
|
358
|
-
subject { VideoInfo.new('<a href="http://www.youtube.com/watch?v=mZqGqE0D0n4">http://www.youtube.com/watch?v=mZqGqE0D0n4</a>') }
|
359
|
-
|
360
|
-
describe '#provider' do
|
361
|
-
subject { super().provider }
|
362
|
-
it { is_expected.to eq('YouTube') }
|
363
|
-
end
|
364
|
-
|
365
|
-
describe '#video_id' do
|
366
|
-
subject { super().video_id }
|
367
|
-
it { is_expected.to eq('mZqGqE0D0n4') }
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
|
-
context "with iframe attributes", :vcr do
|
372
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
373
|
-
|
374
|
-
describe '#provider' do
|
375
|
-
subject { super().provider }
|
376
|
-
it { is_expected.to eq('YouTube') }
|
377
|
-
end
|
378
|
-
it { expect(subject.embed_code(iframe_attributes: { width: 800, height: 600 })).to match(/width="800"/) }
|
379
|
-
it { expect(subject.embed_code(iframe_attributes: { width: 800, height: 600 })).to match(/height="600"/) }
|
380
|
-
end
|
381
|
-
|
382
|
-
context "with arbitrary iframe_attributes", :vcr do
|
383
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
384
|
-
|
385
|
-
describe '#provider' do
|
386
|
-
subject { super().provider }
|
387
|
-
it { is_expected.to eq('YouTube') }
|
388
|
-
end
|
389
|
-
it { expect(subject.embed_code(iframe_attributes: { :'data-colorbox' => true })).to match(/data-colorbox="true"/) }
|
390
|
-
end
|
391
|
-
|
392
|
-
context "with full screen video URLs", :vcr do
|
393
|
-
subject { VideoInfo.new('http://www.youtube.com/v/mZqGqE0D0n4') }
|
394
|
-
|
395
|
-
describe '#provider' do
|
396
|
-
subject { super().provider }
|
397
|
-
it { is_expected.to eq 'YouTube' }
|
398
|
-
end
|
399
|
-
|
400
|
-
describe '#video_id' do
|
401
|
-
subject { super().video_id }
|
402
|
-
it { is_expected.to eq 'mZqGqE0D0n4' }
|
403
|
-
end
|
404
|
-
|
405
|
-
describe '#url' do
|
406
|
-
subject { super().url }
|
407
|
-
it { is_expected.to eq 'http://www.youtube.com/v/mZqGqE0D0n4' }
|
408
|
-
end
|
409
|
-
|
410
|
-
describe '#embed_url' do
|
411
|
-
subject { super().embed_url }
|
412
|
-
it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
|
413
|
-
end
|
414
|
-
|
415
|
-
describe '#embed_code' do
|
416
|
-
subject { super().embed_code }
|
417
|
-
it { is_expected.to eq '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
418
|
-
end
|
419
|
-
|
420
|
-
describe '#title' do
|
421
|
-
subject { super().title }
|
422
|
-
it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
|
423
|
-
end
|
424
|
-
|
425
|
-
describe '#description' do
|
426
|
-
subject { super().description }
|
427
|
-
it { is_expected.to eq 'The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net' }
|
428
|
-
end
|
429
|
-
|
430
|
-
describe '#keywords' do
|
431
|
-
subject { super().keywords }
|
432
|
-
it { is_expected.to eq %w(cherry bloom king of the knife guitar drum clip rock alternative tremplin Paris-Forum) }
|
433
|
-
end
|
434
|
-
|
435
|
-
describe '#duration' do
|
436
|
-
subject { super().duration }
|
437
|
-
it { is_expected.to eq 176 }
|
438
|
-
end
|
439
|
-
|
440
|
-
describe '#width' do
|
441
|
-
subject { super().width }
|
442
|
-
it { is_expected.to be_nil }
|
443
|
-
end
|
444
|
-
|
445
|
-
describe '#height' do
|
446
|
-
subject { super().height }
|
447
|
-
it { is_expected.to be_nil }
|
448
|
-
end
|
449
|
-
|
450
|
-
describe '#date' do
|
451
|
-
subject { super().date }
|
452
|
-
it { is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008', Time.now.utc) }
|
453
|
-
end
|
454
|
-
|
455
|
-
describe '#thumbnail_small' do
|
456
|
-
subject { super().thumbnail_small }
|
457
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg' }
|
458
|
-
end
|
459
|
-
|
460
|
-
describe '#thumbnail_medium' do
|
461
|
-
subject { super().thumbnail_medium }
|
462
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg' }
|
463
|
-
end
|
464
|
-
|
465
|
-
describe '#thumbnail_large' do
|
466
|
-
subject { super().thumbnail_large }
|
467
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg' }
|
468
|
-
end
|
469
|
-
|
470
|
-
describe '#view_count' do
|
471
|
-
subject { super().view_count }
|
472
|
-
it { is_expected.to be > 4000 }
|
473
|
-
end
|
474
|
-
end
|
475
|
-
|
476
|
-
end
|