video_info 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rubocop.yml +242 -1
- data/.travis.yml +9 -8
- data/CONTRIBUTING.md +11 -0
- data/Gemfile +1 -1
- data/Guardfile +1 -1
- data/README.md +34 -1
- data/lib/video_info.rb +22 -26
- data/lib/video_info/provider.rb +8 -10
- data/lib/video_info/providers/dailymotion.rb +6 -3
- data/lib/video_info/providers/vimeo.rb +3 -3
- data/lib/video_info/providers/vimeo_api.rb +13 -4
- data/lib/video_info/providers/vimeo_scraper.rb +33 -13
- data/lib/video_info/providers/vkontakte.rb +38 -14
- data/lib/video_info/providers/wistia.rb +2 -1
- data/lib/video_info/providers/youtube.rb +4 -2
- data/lib/video_info/providers/youtube_api.rb +38 -3
- data/lib/video_info/providers/youtube_scraper.rb +26 -12
- data/lib/video_info/providers/youtubeplaylist.rb +5 -2
- data/lib/video_info/providers/youtubeplaylist_api.rb +8 -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 +89 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_valid_video/_available_/1_2_1_1_1.yml +92 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_date/should_show_correct_date.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_description/1_3_7_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_duration/1_3_9_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_keywords/1_3_8_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_large/1_3_15_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/1_3_14_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_small/1_3_13_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_title/1_3_6_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_view_count/1_3_16_1.yml +95 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/1_2_3_1_1.yml +964 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/2_2_3_1_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/1_2_2_1_1.yml +936 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/2_2_2_1_1.yml +61 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/1_2_1_1_1.yml +2692 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/2_2_1_1_1.yml +119 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/1_3_17_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/2_3_17_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/1_3_16_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/2_3_16_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/1_3_18_1.yml +1529 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/2_3_18_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_date/should_have_correct_upload_date.yml +1595 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/1_3_7_1.yml +1602 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/2_3_7_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/1_3_9_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/2_3_9_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/1_3_11_1.yml +1529 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/2_3_11_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_keywords/should_return_a_string_list_of_keywords.yml +1595 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/1_3_15_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/2_3_15_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/1_3_14_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/2_3_14_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/1_3_13_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/2_3_13_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/1_3_6_1.yml +1602 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/2_3_6_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/1_3_19_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/2_3_19_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/1_3_10_1.yml +1530 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/2_3_10_1.yml +68 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author/1_3_17_1.yml +2559 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author/2_3_17_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_thumbnail/1_3_16_1.yml +2559 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_thumbnail/2_3_16_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_url/1_3_18_1.yml +2559 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_url/2_3_18_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_date/should_have_correct_upload_date.yml +2714 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/1_3_7_1.yml +2692 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/2_3_7_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/1_3_9_1.yml +2829 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/2_3_9_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/1_3_11_1.yml +2828 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/2_3_11_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_keywords/should_return_a_string_list_of_keywords.yml +2716 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/1_3_15_1.yml +2560 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/2_3_15_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/1_3_14_1.yml +2558 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/2_3_14_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/1_3_13_1.yml +2558 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/2_3_13_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/1_3_6_1.yml +2961 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/2_3_6_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/1_3_19_1.yml +2560 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/2_3_19_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/1_3_10_1.yml +2560 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/2_3_10_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_hashes/available_/1_2_6_1_1.yml +2996 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_invalid_video/available_/1_2_2_1_1.yml +46 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_private_video/available_/1_2_3_1_1.yml +865 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect/available_/1_2_4_1_1.yml +666 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect_to_main_page_for_auth/available_/1_2_5_1_1.yml +46 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_valid_video/available_/1_2_1_1_1.yml +2118 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author/1_5_14_1.yml +518 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author_thumbnail/1_5_15_1.yml +519 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author_url/1_5_16_1.yml +520 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/description/1_5_8_1.yml +518 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/duration/1_5_10_1.yml +517 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/embed_code/1_5_6_1.yml +517 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/embed_url/1_5_5_1.yml +519 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/height/1_5_12_1.yml +517 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/title/1_5_7_1.yml +517 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/view_count/1_5_13_1.yml +521 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/width/1_5_11_1.yml +517 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/author/1_3_7_1.yml +399 -0
- 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 +399 -0
- 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 +399 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/title/1_3_4_1.yml +399 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video-54799401_165822734/title/1_7_4_1.yml +682 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video3552522_171340713/embed_url/1_10_1_1.yml +501 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/description/1_6_8_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/duration/1_6_10_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_code/1_6_6_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_url/1_6_5_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/height/1_6_12_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/title/1_6_7_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/view_count/1_6_13_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/width/1_6_11_1.yml +449 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author/1_4_5_1.yml +527 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_thumbnail/1_4_6_1.yml +527 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_url/1_4_7_1.yml +527 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/title/1_4_4_1.yml +527 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_invalid_video/_available_/1_2_2_1_1.yml +71 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_valid_video/_available_/1_2_1_1_1.yml +73 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_duration/1_4_7_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_height/1_4_9_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_large/1_4_12_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_medium/1_4_11_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_small/1_4_10_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_title/1_4_6_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_width/1_4_8_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_duration/1_3_7_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_height/1_3_9_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_large/1_3_12_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_medium/1_3_11_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_small/1_3_10_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_title/1_3_6_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_width/1_3_8_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/1_2_2_1_1.yml +516 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/2_2_2_1_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/1_2_2_11_1.yml +519 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/2_2_2_11_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/1_2_2_8_1.yml +521 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/2_2_2_8_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/1_2_2_10_1.yml +519 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/2_2_2_10_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/1_2_2_9_1.yml +519 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/2_2_2_9_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/1_2_2_7_1.yml +519 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/2_2_2_7_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_2_15_1.yml +516 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_2_15_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/1_2_1_1_1.yml +3930 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/2_2_1_1_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/1_2_3_1_1.yml +578 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/2_2_3_1_1.yml +117 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_date/should_return_date_video_was_posted.yml +3912 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/1_17_7_1.yml +4007 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/2_17_7_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/1_17_9_1.yml +3982 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/2_17_9_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/1_17_8_1.yml +3984 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/2_17_8_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/1_17_6_1.yml +3946 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/2_17_6_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/1_17_16_1.yml +3948 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/2_17_16_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/1_3_6_1.yml +4006 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/2_3_6_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/1_3_7_1.yml +4027 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/2_3_7_1.yml +212 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/1_3_8_1.yml +4080 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/2_3_8_1.yml +212 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_date/should_return_date_video_was_posted.yml +3982 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/1_3_10_1.yml +3992 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/2_3_10_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/1_3_12_1.yml +3961 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/2_3_12_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/1_3_11_1.yml +3928 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/2_3_11_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/1_3_9_1.yml +3974 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/2_3_9_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/1_3_19_1.yml +3950 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/2_3_19_1.yml +127 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/1_2_2_1_1.yml +62 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/2_2_2_1_1.yml +62 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/1_2_3_1_1.yml +96 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/2_2_3_1_1.yml +96 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/1_2_1_1_1.yml +96 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/2_2_1_1_1.yml +96 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/1_3_18_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/2_3_18_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/1_3_19_1.yml +193 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/2_3_19_1.yml +193 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/1_3_20_1.yml +193 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/2_3_20_1.yml +193 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/1_3_7_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/2_3_7_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/1_3_8_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/2_3_8_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/1_3_15_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/2_3_15_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/1_3_14_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/2_3_14_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/1_3_13_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/2_3_13_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/1_3_6_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/2_3_6_1.yml +107 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_videos/returns_list_of_videos_in_playlist.yml +267 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/1_4_2_1.yml +56 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/2_4_2_1.yml +56 -0
- data/spec/lib/video_info/provider_spec.rb +42 -22
- data/spec/lib/video_info/providers/dailymotion_spec.rb +41 -23
- data/spec/lib/video_info/providers/vimeo_spec.rb +212 -177
- data/spec/lib/video_info/providers/vkontakte_spec.rb +132 -63
- data/spec/lib/video_info/providers/wistia_spec.rb +34 -13
- data/spec/lib/video_info/providers/youtube_playlist_spec.rb +185 -139
- data/spec/lib/video_info/providers/youtube_spec.rb +400 -385
- data/spec/lib/video_info_spec.rb +27 -21
- data/video_info.gemspec +7 -10
- metadata +424 -87
- data/foo.txt +0 -33
- data/spec/lib/video_info/providers/vimeo_api_spec.rb +0 -242
- 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
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.googleapis.com/youtube/v3/playlistItems?fields=items&key=AIzaSyA6PYwSr1EnLFUFy1cZDk3Ifb0rxeJaeZ0&part=snippet&playlistId=PL0E8117603D70E10A
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- VideoInfo/2.6.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Expires:
|
22
|
+
- Thu, 05 May 2016 01:01:55 GMT
|
23
|
+
Date:
|
24
|
+
- Thu, 05 May 2016 01:01:55 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- private, max-age=0, must-revalidate, no-transform
|
27
|
+
Etag:
|
28
|
+
- '"kiOs9cZLH2FUp6r6KJ8eyq_LIOk/ewwRz0VbTYpp2EGbOkvZ5M_1mbo"'
|
29
|
+
Vary:
|
30
|
+
- Origin
|
31
|
+
- X-Origin
|
32
|
+
Content-Type:
|
33
|
+
- application/json; charset=UTF-8
|
34
|
+
X-Content-Type-Options:
|
35
|
+
- nosniff
|
36
|
+
X-Frame-Options:
|
37
|
+
- SAMEORIGIN
|
38
|
+
X-Xss-Protection:
|
39
|
+
- 1; mode=block
|
40
|
+
Content-Length:
|
41
|
+
- '17'
|
42
|
+
Server:
|
43
|
+
- GSE
|
44
|
+
Alternate-Protocol:
|
45
|
+
- 443:quic
|
46
|
+
Alt-Svc:
|
47
|
+
- quic=":443"; ma=2592000; v="33,32,31,30,29,28,27,26,25"
|
48
|
+
body:
|
49
|
+
encoding: UTF-8
|
50
|
+
string: |
|
51
|
+
{
|
52
|
+
"items": []
|
53
|
+
}
|
54
|
+
http_version:
|
55
|
+
recorded_at: Thu, 05 May 2016 01:01:55 GMT
|
56
|
+
recorded_with: VCR 3.0.1
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.googleapis.com/youtube/v3/playlistItems?fields=items&key=AIzaSyA6PYwSr1EnLFUFy1cZDk3Ifb0rxeJaeZ0&part=snippet&playlistId=PL0E8117603D70E10A
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- VideoInfo/2.6.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Expires:
|
22
|
+
- Thu, 05 May 2016 01:01:57 GMT
|
23
|
+
Date:
|
24
|
+
- Thu, 05 May 2016 01:01:57 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- private, max-age=0, must-revalidate, no-transform
|
27
|
+
Etag:
|
28
|
+
- '"kiOs9cZLH2FUp6r6KJ8eyq_LIOk/ewwRz0VbTYpp2EGbOkvZ5M_1mbo"'
|
29
|
+
Vary:
|
30
|
+
- Origin
|
31
|
+
- X-Origin
|
32
|
+
Content-Type:
|
33
|
+
- application/json; charset=UTF-8
|
34
|
+
X-Content-Type-Options:
|
35
|
+
- nosniff
|
36
|
+
X-Frame-Options:
|
37
|
+
- SAMEORIGIN
|
38
|
+
X-Xss-Protection:
|
39
|
+
- 1; mode=block
|
40
|
+
Content-Length:
|
41
|
+
- '17'
|
42
|
+
Server:
|
43
|
+
- GSE
|
44
|
+
Alternate-Protocol:
|
45
|
+
- 443:quic
|
46
|
+
Alt-Svc:
|
47
|
+
- quic=":443"; ma=2592000; v="33,32,31,30,29,28,27,26,25"
|
48
|
+
body:
|
49
|
+
encoding: UTF-8
|
50
|
+
string: |
|
51
|
+
{
|
52
|
+
"items": []
|
53
|
+
}
|
54
|
+
http_version:
|
55
|
+
recorded_at: Thu, 05 May 2016 01:01:57 GMT
|
56
|
+
recorded_with: VCR 3.0.1
|
@@ -3,58 +3,78 @@ require 'spec_helper'
|
|
3
3
|
describe VideoInfo::Provider do
|
4
4
|
class ProviderFu < VideoInfo::Provider
|
5
5
|
def _url_regex
|
6
|
-
|
6
|
+
%r{foo\/(\d)}
|
7
7
|
end
|
8
8
|
|
9
9
|
def embed_url
|
10
|
-
|
10
|
+
'//foo.com'
|
11
11
|
end
|
12
12
|
|
13
13
|
def _default_url_attributes; {} end
|
14
|
+
|
14
15
|
def _default_iframe_attributes; {} end
|
15
16
|
end
|
16
17
|
let(:url) { 'url' }
|
17
|
-
let(:options) { {
|
18
|
+
let(:options) { {} }
|
18
19
|
let(:provider) { ProviderFu.new('foo/1', options) }
|
19
20
|
|
20
|
-
describe
|
21
|
+
describe 'initialize' do
|
22
|
+
it 'should raise error if #_url_regex is not implemented' do
|
23
|
+
error_msg = 'Provider class must implement #_url_regex private method'
|
24
|
+
expected = expect { VideoInfo::Provider.new(url) }
|
25
|
+
expected.to raise_error(NotImplementedError, error_msg)
|
26
|
+
end
|
21
27
|
|
22
|
-
it
|
23
|
-
|
28
|
+
it 'should raise error if #_api_url is not implemented' do
|
29
|
+
api_url_error_msg = 'Provider class must implement ' \
|
30
|
+
'#_api_url private method'
|
31
|
+
expected = expect { provider.data }
|
32
|
+
expected.to raise_error(NotImplementedError, api_url_error_msg)
|
33
|
+
end
|
24
34
|
|
25
|
-
it
|
26
|
-
|
35
|
+
it 'sets default user_agent options' do
|
36
|
+
user_agent_hash = { 'User-Agent' => "VideoInfo/#{VideoInfo::VERSION}" }
|
37
|
+
expect(provider.options).to eq(user_agent_hash)
|
27
38
|
end
|
28
39
|
|
29
|
-
context
|
40
|
+
context 'with custom User-Agent options' do
|
30
41
|
let(:options) { { 'User-Agent' => 'Test User Agent / 1.0' } }
|
31
42
|
|
32
|
-
it
|
33
|
-
expect(provider.options).to eq(
|
43
|
+
it 'sets the option' do
|
44
|
+
expect(provider.options).to eq('User-Agent' => 'Test User Agent / 1.0')
|
34
45
|
end
|
35
46
|
end
|
36
47
|
|
37
|
-
context
|
48
|
+
context 'with Referer options' do
|
38
49
|
let(:options) { { referer: 'http://google.com' } }
|
39
50
|
|
40
|
-
it
|
41
|
-
expect(provider.options).to include(
|
51
|
+
it 'sets the option' do
|
52
|
+
expect(provider.options).to include('Referer' => 'http://google.com')
|
42
53
|
end
|
43
54
|
end
|
44
55
|
end
|
45
56
|
|
46
|
-
describe
|
47
|
-
it
|
48
|
-
|
57
|
+
describe 'embed_code' do
|
58
|
+
it 'supports url_attributes option' do
|
59
|
+
embed_str = '<iframe src="//foo.com?foo=bar" frameborder="0"></iframe>'
|
60
|
+
expected = expect(provider.embed_code(url_attributes: { foo: 'bar' }))
|
61
|
+
expected.to eq embed_str
|
49
62
|
end
|
50
63
|
|
51
|
-
it
|
52
|
-
|
64
|
+
it 'supports url_attributes option' do
|
65
|
+
embed_str = '<iframe src="//foo.com" frameborder="0" foo="bar"></iframe>'
|
66
|
+
expected = expect(provider.embed_code(iframe_attributes: { foo: 'bar' }))
|
67
|
+
expected.to eq embed_str
|
53
68
|
end
|
54
69
|
end
|
55
70
|
|
56
|
-
describe
|
57
|
-
it
|
71
|
+
describe '.usable?' do
|
72
|
+
it 'should raise eror if not usable' do
|
73
|
+
error_msg = 'Provider class must implement .usable? public method'
|
74
|
+
expected = expect do
|
75
|
+
VideoInfo::Provider.usable?('url')
|
76
|
+
end
|
77
|
+
expected.to raise_error(NotImplementedError, error_msg)
|
78
|
+
end
|
58
79
|
end
|
59
|
-
|
60
80
|
end
|
@@ -2,28 +2,27 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe VideoInfo::Providers::Dailymotion do
|
5
|
-
|
6
|
-
describe ".usable?" do
|
5
|
+
describe '.usable?' do
|
7
6
|
subject { VideoInfo::Providers::Dailymotion.usable?(url) }
|
8
7
|
|
9
|
-
context
|
8
|
+
context 'with dailymotion url' do
|
10
9
|
let(:url) { 'http://www.dailymotion.com/video/x7lni3' }
|
11
10
|
it { is_expected.to be_truthy }
|
12
11
|
end
|
13
12
|
|
14
|
-
context
|
13
|
+
context 'with dai.ly url' do
|
15
14
|
let(:url) { 'http://dai.ly/video/x7lni3' }
|
16
15
|
it { is_expected.to be_truthy }
|
17
16
|
end
|
18
17
|
|
19
|
-
context
|
18
|
+
context 'with other url' do
|
20
19
|
let(:url) { 'http://www.youtube.com/x7lni3' }
|
21
20
|
it { is_expected.to be_falsey }
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
|
-
describe
|
26
|
-
context
|
24
|
+
describe '#available?' do
|
25
|
+
context 'with valid video', :vcr do
|
27
26
|
subject { VideoInfo.new('http://www.dailymotion.com/video/x7lni3') }
|
28
27
|
|
29
28
|
describe '#available?' do
|
@@ -32,7 +31,7 @@ describe VideoInfo::Providers::Dailymotion do
|
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
35
|
-
context
|
34
|
+
context 'with invalid video url', :vcr do
|
36
35
|
subject { VideoInfo.new('http://www.dailymotion.com/video/inValIdiD') }
|
37
36
|
|
38
37
|
describe '#available?' do
|
@@ -42,7 +41,7 @@ describe VideoInfo::Providers::Dailymotion do
|
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
context
|
44
|
+
context 'with video x7lni3', :vcr do
|
46
45
|
subject { VideoInfo.new('http://www.dailymotion.com/video/x7lni3') }
|
47
46
|
|
48
47
|
describe '#provider' do
|
@@ -67,7 +66,9 @@ describe VideoInfo::Providers::Dailymotion do
|
|
67
66
|
|
68
67
|
describe '#embed_code' do
|
69
68
|
subject { super().embed_code }
|
70
|
-
|
69
|
+
embed_code = '<iframe src="//www.dailymotion.com/embed/video/x7lni3?' \
|
70
|
+
'autoplay=0" frameborder="0"></iframe>'
|
71
|
+
it { is_expected.to eq embed_code }
|
71
72
|
end
|
72
73
|
|
73
74
|
describe '#title' do
|
@@ -77,17 +78,23 @@ describe VideoInfo::Providers::Dailymotion do
|
|
77
78
|
|
78
79
|
describe '#description' do
|
79
80
|
subject { super().description }
|
80
|
-
|
81
|
+
description_text = 'Super Rémi Kart est un jeu vidéo de course ' \
|
82
|
+
'développé et édité par N\'Importe Quoi TV. ' \
|
83
|
+
'Sa principale originalité vient de sa réalité' \
|
84
|
+
'...<br />L\'aventure continue sur www.nimportequi.com'
|
85
|
+
it { is_expected.to eq description_text }
|
81
86
|
end
|
82
87
|
|
83
88
|
describe '#keywords' do
|
84
89
|
subject { super().keywords }
|
85
|
-
|
90
|
+
keywords_list = %w(rémi remi gaillard imposteur imposture
|
91
|
+
mario bros kart nintendo jeux)
|
92
|
+
it { is_expected.to eq keywords_list }
|
86
93
|
end
|
87
94
|
|
88
95
|
describe '#duration' do
|
89
96
|
subject { super().duration }
|
90
|
-
it { is_expected.to eq 136}
|
97
|
+
it { is_expected.to eq 136 }
|
91
98
|
end
|
92
99
|
|
93
100
|
describe '#width' do
|
@@ -102,7 +109,9 @@ describe VideoInfo::Providers::Dailymotion do
|
|
102
109
|
|
103
110
|
describe '#date' do
|
104
111
|
subject { super().date }
|
105
|
-
it
|
112
|
+
it 'should show correct date' do
|
113
|
+
is_expected.to eq Time.parse('2008-12-03 16:29:31 UTC', Time.now.utc)
|
114
|
+
end
|
106
115
|
end
|
107
116
|
|
108
117
|
describe '#thumbnail_small' do
|
@@ -122,25 +131,35 @@ describe VideoInfo::Providers::Dailymotion do
|
|
122
131
|
|
123
132
|
describe '#view_count' do
|
124
133
|
subject { super().view_count }
|
125
|
-
it { is_expected.to be >
|
134
|
+
it { is_expected.to be > 10_000_000 }
|
126
135
|
end
|
127
136
|
end
|
128
137
|
|
129
|
-
context
|
138
|
+
context 'with video x7lni3 and url_attributes', :vcr do
|
130
139
|
subject { VideoInfo.new('http://www.dailymotion.com/video/x7lni3') }
|
131
140
|
|
132
|
-
it
|
141
|
+
it do
|
142
|
+
embed_code = subject.embed_code(url_attributes: { autoplay: 1 })
|
143
|
+
expect(embed_code).to match(/autoplay=1/)
|
144
|
+
end
|
133
145
|
end
|
134
146
|
|
135
|
-
context
|
147
|
+
context 'with video x7lni3 and iframe_attributes', :vcr do
|
136
148
|
subject { VideoInfo.new('http://www.dailymotion.com/video/x7lni3') }
|
137
149
|
|
138
|
-
it
|
139
|
-
|
150
|
+
it 'should properly apply dimensions attributes' do
|
151
|
+
dimensions = { width: 800, height: 600 }
|
152
|
+
embed_code = subject.embed_code(iframe_attributes: dimensions)
|
153
|
+
expect(embed_code).to match(/width="800"/)
|
154
|
+
expect(embed_code).to match(/height="600"/)
|
155
|
+
end
|
140
156
|
end
|
141
157
|
|
142
|
-
context
|
143
|
-
|
158
|
+
context 'with video x7lni3 in text', :vcr do
|
159
|
+
url_in_text = '<a href="http://www.dailymotion.com/video/x7lni3">' \
|
160
|
+
'http://www.dailymotion.com/video/x7lni3</a>'
|
161
|
+
|
162
|
+
subject { VideoInfo.new(url_in_text) }
|
144
163
|
|
145
164
|
describe '#provider' do
|
146
165
|
subject { super().provider }
|
@@ -152,5 +171,4 @@ describe VideoInfo::Providers::Dailymotion do
|
|
152
171
|
it { is_expected.to eq 'x7lni3' }
|
153
172
|
end
|
154
173
|
end
|
155
|
-
|
156
174
|
end
|
@@ -1,242 +1,277 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
[nil, '6b66b015a3504793b4f541d878f46ff6'].each do |api_key|
|
4
|
+
describe VideoInfo::Providers::Vimeo do
|
5
|
+
before(:all) do
|
6
|
+
VideoInfo.provider_api_keys = { vimeo: api_key }
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
describe '.usable?' do
|
10
|
+
subject { VideoInfo::Providers::Vimeo.usable?(url) }
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
context 'with vimeo url' do
|
13
|
+
let(:url) { 'http://www.vimeo.com/898029' }
|
14
|
+
it { is_expected.to be_truthy }
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
context 'with Vimeo OnDemand url' do
|
18
|
+
let(:url) { 'https://vimeo.com/ondemand/less/101677664' }
|
19
|
+
it { is_expected.to be_truthy }
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
context 'with Vimeo Channels url' do
|
23
|
+
let(:url) { 'https://vimeo.com/channels/any_channel/111431415' }
|
24
|
+
it { is_expected.to be_truthy }
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
context 'with Vimeo Review url' do
|
28
|
+
video_url = 'https://vimeo.com/user39798190/review/126641548/8a56234e32'
|
29
|
+
let(:url) { video_url }
|
30
|
+
it { is_expected.to be_truthy }
|
31
|
+
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
context 'with vimeo album url' do
|
34
|
+
let(:url) { 'http://vimeo.com/album/2755718' }
|
35
|
+
it { is_expected.to be_falsey }
|
36
|
+
end
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
context 'with vimeo hubnub embed url' do
|
39
|
+
let(:url) { 'http://player.vimeo.com/hubnut/album/2755718' }
|
40
|
+
it { is_expected.to be_falsey }
|
41
|
+
end
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
context 'with other url' do
|
44
|
+
let(:url) { 'http://www.youtube.com/898029' }
|
45
|
+
it { is_expected.to be_falsey }
|
46
|
+
end
|
44
47
|
end
|
45
|
-
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
describe '#available?' do
|
50
|
+
context 'with valid video', :vcr do
|
51
|
+
subject { VideoInfo.new('http://vimeo.com/98605382') }
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
+
describe '#available?' do
|
54
|
+
it { is_expected.to be_available }
|
55
|
+
end
|
53
56
|
end
|
54
|
-
end
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
+
context "with 'this video does not exist' video", :vcr do
|
59
|
+
subject { VideoInfo.new('http://vimeo.com/59312311') }
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
+
describe '#available?' do
|
62
|
+
it { is_expected.to_not be_available }
|
63
|
+
end
|
61
64
|
end
|
62
|
-
end
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
+
context "with 'password required' video", :vcr do
|
67
|
+
subject { VideoInfo.new('http://vimeo.com/74636562') }
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
+
describe '#available?' do
|
70
|
+
it { is_expected.to_not be_available }
|
71
|
+
end
|
69
72
|
end
|
70
73
|
end
|
71
|
-
end
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
+
context 'with video 136971428', :vcr do
|
76
|
+
subject { VideoInfo.new('https://vimeo.com/136971428') }
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
describe '#provider' do
|
79
|
+
subject { super().provider }
|
80
|
+
it { is_expected.to eq 'Vimeo' }
|
81
|
+
end
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
describe '#video_id' do
|
84
|
+
subject { super().video_id }
|
85
|
+
it { is_expected.to eq '136971428' }
|
86
|
+
end
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
describe '#url' do
|
89
|
+
subject { super().url }
|
90
|
+
it { is_expected.to eq 'https://vimeo.com/136971428' }
|
91
|
+
end
|
90
92
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
93
|
+
describe '#embed_url' do
|
94
|
+
subject { super().embed_url }
|
95
|
+
it { is_expected.to eq '//player.vimeo.com/video/136971428' }
|
96
|
+
end
|
95
97
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
98
|
+
describe '#embed_code' do
|
99
|
+
subject { super().embed_code }
|
100
|
+
embed_code = '<iframe src="//player.vimeo.com/video/136971428?' \
|
101
|
+
'title=0&byline=0&portrait=0&autoplay=0" ' \
|
102
|
+
'frameborder="0"></iframe>'
|
103
|
+
it { is_expected.to eq embed_code }
|
104
|
+
end
|
100
105
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
106
|
+
describe '#title' do
|
107
|
+
subject { super().title }
|
108
|
+
it { is_expected.to eq "Deafheaven - 'New Bermuda' Trailer" }
|
109
|
+
end
|
105
110
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
111
|
+
describe '#description' do
|
112
|
+
subject { super().description }
|
113
|
+
description = "'New Bermuda,' the upcoming album from Deafheaven, " \
|
114
|
+
'is available October 2nd'
|
115
|
+
it { is_expected.to eq description }
|
116
|
+
end
|
110
117
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
118
|
+
describe '#keywords' do
|
119
|
+
subject { super().keywords }
|
120
|
+
it 'should return a string list of keywords' do
|
121
|
+
keywords_list = []
|
122
|
+
is_expected.to eq keywords_list
|
123
|
+
end
|
124
|
+
end
|
115
125
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
126
|
+
describe '#duration' do
|
127
|
+
subject { super().duration }
|
128
|
+
it { is_expected.to eq 59 }
|
129
|
+
end
|
120
130
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
131
|
+
describe '#width' do
|
132
|
+
subject { super().width }
|
133
|
+
it { is_expected.to eq 1280 }
|
134
|
+
end
|
125
135
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
136
|
+
describe '#height' do
|
137
|
+
subject { super().height }
|
138
|
+
it { is_expected.to eq 720 }
|
139
|
+
end
|
130
140
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
141
|
+
describe '#date' do
|
142
|
+
subject { super().date }
|
143
|
+
it 'should have correct upload date' do
|
144
|
+
is_expected.to eq Time.parse('2015-08-21T21:37:43+00:00',
|
145
|
+
Time.now.utc).utc
|
146
|
+
end
|
147
|
+
end
|
135
148
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
149
|
+
describe '#thumbnail_small' do
|
150
|
+
subject { super().thumbnail_small }
|
151
|
+
thumbnail_url = 'https://i.vimeocdn.com/video/531688239_100x75.jpg'
|
152
|
+
it { is_expected.to eq thumbnail_url }
|
153
|
+
end
|
140
154
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
155
|
+
describe '#thumbnail_medium' do
|
156
|
+
subject { super().thumbnail_medium }
|
157
|
+
thumbnail_url = 'https://i.vimeocdn.com/video/531688239_200x150.jpg'
|
158
|
+
it { is_expected.to eq thumbnail_url }
|
159
|
+
end
|
145
160
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
161
|
+
describe '#thumbnail_large' do
|
162
|
+
subject { super().thumbnail_large }
|
163
|
+
thumbnail_url = 'https://i.vimeocdn.com/video/531688239_640.jpg'
|
164
|
+
it { is_expected.to eq thumbnail_url }
|
165
|
+
end
|
150
166
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
167
|
+
describe '#author_thumbnail' do
|
168
|
+
subject { super().author_thumbnail }
|
169
|
+
thumbnail_url = 'https://i.vimeocdn.com/portrait/327118_75x75.jpg'
|
170
|
+
it { is_expected.to eq thumbnail_url }
|
171
|
+
end
|
155
172
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
173
|
+
describe '#author' do
|
174
|
+
subject { super().author }
|
175
|
+
it { is_expected.to eq 'Anti Records' }
|
176
|
+
end
|
177
|
+
|
178
|
+
describe '#author_url' do
|
179
|
+
subject { super().author_url }
|
180
|
+
it { is_expected.to eq 'https://vimeo.com/antirecords' }
|
181
|
+
end
|
160
182
|
|
161
|
-
|
162
|
-
|
163
|
-
|
183
|
+
describe '#view_count' do
|
184
|
+
subject { super().view_count }
|
185
|
+
it { is_expected.to be > 80 }
|
186
|
+
end
|
164
187
|
end
|
165
|
-
end
|
166
188
|
|
167
|
-
|
168
|
-
|
189
|
+
context 'with video 898029 and url_attributes', :vcr do
|
190
|
+
subject { VideoInfo.new('http://www.vimeo.com/898029') }
|
169
191
|
|
170
|
-
|
171
|
-
|
192
|
+
it 'should add URL attribute' do
|
193
|
+
attributes = { autoplay: 1 }
|
194
|
+
embed_code = subject.embed_code(url_attributes: attributes)
|
195
|
+
expect(embed_code).to match(/autoplay=1/)
|
196
|
+
end
|
197
|
+
end
|
172
198
|
|
173
|
-
|
174
|
-
|
199
|
+
context 'with video 898029 and iframe_attributes', :vcr do
|
200
|
+
subject { VideoInfo.new('http://www.vimeo.com/898029') }
|
175
201
|
|
176
|
-
|
177
|
-
|
178
|
-
|
202
|
+
it 'should have proper dimensions' do
|
203
|
+
dimensions = { width: 800, height: 600 }
|
204
|
+
embed_code = subject.embed_code(iframe_attributes: dimensions)
|
205
|
+
expect(embed_code).to match(/width="800"/)
|
206
|
+
expect(embed_code).to match(/height="600"/)
|
207
|
+
end
|
208
|
+
end
|
179
209
|
|
180
|
-
|
181
|
-
|
210
|
+
context 'with video 898029 in /group/ url', :vcr do
|
211
|
+
subject { VideoInfo.new('http://vimeo.com/groups/1234/videos/898029') }
|
182
212
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
213
|
+
describe '#provider' do
|
214
|
+
subject { super().provider }
|
215
|
+
it { is_expected.to eq 'Vimeo' }
|
216
|
+
end
|
187
217
|
|
188
|
-
|
189
|
-
|
190
|
-
|
218
|
+
describe '#video_id' do
|
219
|
+
subject { super().video_id }
|
220
|
+
it { is_expected.to eq '898029' }
|
221
|
+
end
|
191
222
|
end
|
192
|
-
end
|
193
223
|
|
194
|
-
|
195
|
-
|
224
|
+
context 'with video 898029 in /group/ url', :vcr do
|
225
|
+
subject { VideoInfo.new('http://player.vimeo.com/video/898029') }
|
196
226
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
227
|
+
describe '#provider' do
|
228
|
+
subject { super().provider }
|
229
|
+
it { is_expected.to eq 'Vimeo' }
|
230
|
+
end
|
201
231
|
|
202
|
-
|
203
|
-
|
204
|
-
|
232
|
+
describe '#video_id' do
|
233
|
+
subject { super().video_id }
|
234
|
+
it { is_expected.to eq '898029' }
|
235
|
+
end
|
205
236
|
end
|
206
|
-
end
|
207
237
|
|
208
|
-
|
209
|
-
|
238
|
+
context 'with video 898029 in text', :vcr do
|
239
|
+
video_url_in_text = '<a href="http://www.vimeo.com/898029">' \
|
240
|
+
'http://www.vimeo.com/898029</a>'
|
241
|
+
subject { VideoInfo.new(video_url_in_text) }
|
210
242
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
243
|
+
describe '#provider' do
|
244
|
+
subject { super().provider }
|
245
|
+
it { is_expected.to eq 'Vimeo' }
|
246
|
+
end
|
215
247
|
|
216
|
-
|
217
|
-
|
218
|
-
|
248
|
+
describe '#video_id' do
|
249
|
+
subject { super().video_id }
|
250
|
+
it { is_expected.to eq '898029' }
|
251
|
+
end
|
219
252
|
end
|
220
|
-
end
|
221
253
|
|
222
|
-
|
223
|
-
|
254
|
+
context 'with video 101677664 in /ondemand/ url', :vcr do
|
255
|
+
subject { VideoInfo.new('https://vimeo.com/ondemand/less/101677664') }
|
224
256
|
|
225
|
-
|
226
|
-
|
227
|
-
|
257
|
+
its(:provider) { should eq 'Vimeo' }
|
258
|
+
its(:video_id) { should eq '101677664' }
|
259
|
+
end
|
228
260
|
|
229
|
-
|
230
|
-
|
261
|
+
context 'with video 111431415 in /channels/*/ url', :vcr do
|
262
|
+
video_url = 'https://vimeo.com/channels/some_channel1/111431415'
|
263
|
+
subject { VideoInfo.new(video_url) }
|
231
264
|
|
232
|
-
|
233
|
-
|
234
|
-
|
265
|
+
its(:provider) { should eq 'Vimeo' }
|
266
|
+
its(:video_id) { should eq '111431415' }
|
267
|
+
end
|
235
268
|
|
236
|
-
|
237
|
-
|
269
|
+
context 'with video 126641548 in /user*/review/126641548/* url', :vcr do
|
270
|
+
video_url = 'http://www.vimeo.com/user39798190/review/126641548/8a56234e32'
|
271
|
+
subject { VideoInfo.new(video_url) }
|
238
272
|
|
239
|
-
|
240
|
-
|
273
|
+
its(:provider) { should eq 'Vimeo' }
|
274
|
+
its(:video_id) { should eq '126641548' }
|
275
|
+
end
|
241
276
|
end
|
242
277
|
end
|