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
@@ -1,67 +1,142 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'webmock/rspec'
|
3
2
|
|
4
|
-
|
5
|
-
describe
|
6
|
-
|
7
|
-
|
8
|
-
context "with youtube.com url" do
|
9
|
-
let(:url) { 'http://www.youtube.com/watch?v=Xp6CXF' }
|
10
|
-
it { is_expected.to be_truthy }
|
3
|
+
[nil, 'AIzaSyA6PYwSr1EnLFUFy1cZDk3Ifb0rxeJaeZ0'].each do |api_key|
|
4
|
+
describe VideoInfo::Providers::Youtube do
|
5
|
+
before(:all) do
|
6
|
+
VideoInfo.provider_api_keys = { youtube: api_key }
|
11
7
|
end
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
it { is_expected.to be_truthy }
|
16
|
-
end
|
9
|
+
describe '.usable?' do
|
10
|
+
subject { VideoInfo::Providers::Youtube.usable?(url) }
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
context 'with youtube.com url' do
|
13
|
+
let(:url) { 'http://www.youtube.com/watch?v=Xp6CXF' }
|
14
|
+
it { is_expected.to be_truthy }
|
15
|
+
end
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
17
|
+
context 'with youtu.be url' do
|
18
|
+
let(:url) { 'http://youtu.be/JM9NgvjjVng' }
|
19
|
+
it { is_expected.to be_truthy }
|
20
|
+
end
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
context 'with other url' do
|
23
|
+
let(:url) { 'http://google.com/video1' }
|
24
|
+
it { is_expected.to be_falsey }
|
25
|
+
end
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
it { is_expected.to
|
27
|
+
context 'with playlist url' do
|
28
|
+
let(:url) { 'http://www.youtube.com/playlist?p=PLA575C81A1FBC04CF' }
|
29
|
+
it { is_expected.to be_falsey }
|
36
30
|
end
|
37
31
|
end
|
38
32
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
before do
|
43
|
-
VideoInfo.provider_api_keys[:youtube] = 'invalid_key'
|
44
|
-
end
|
33
|
+
describe '#available?' do
|
34
|
+
context 'with valid video', :vcr do
|
35
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
45
36
|
|
46
|
-
|
47
|
-
|
37
|
+
describe '#available?' do
|
38
|
+
subject { super().available? }
|
39
|
+
it { is_expected.to be_truthy }
|
40
|
+
end
|
48
41
|
end
|
49
42
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
43
|
+
context 'with unavailable video', :vcr do
|
44
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=SUkXvWn1m7Q') }
|
45
|
+
|
46
|
+
describe '#available?' do
|
47
|
+
subject { super().available? }
|
48
|
+
it { is_expected.to be_falsey }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#provider' do
|
52
|
+
subject { super().provider }
|
53
|
+
it { is_expected.to eq 'YouTube' }
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#video_id' do
|
57
|
+
subject { super().video_id }
|
58
|
+
it { is_expected.to eq 'SUkXvWn1m7Q' }
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#url' do
|
62
|
+
subject { super().url }
|
63
|
+
it { is_expected.to eq 'http://www.youtube.com/watch?v=SUkXvWn1m7Q' }
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#embed_url' do
|
67
|
+
subject { super().embed_url }
|
68
|
+
it { is_expected.to eq '//www.youtube.com/embed/SUkXvWn1m7Q' }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#embed_code' do
|
72
|
+
subject { super().embed_code }
|
73
|
+
embed_code = '<iframe src="//www.youtube.com/embed/SUkXvWn1m7Q" ' \
|
74
|
+
'frameborder="0" allowfullscreen="allowfullscreen">' \
|
75
|
+
'</iframe>'
|
76
|
+
it { is_expected.to eq embed_code }
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#title' do
|
80
|
+
subject { super().title }
|
81
|
+
it { is_expected.to eq nil }
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#description' do
|
85
|
+
subject { super().description }
|
86
|
+
it { is_expected.to eq nil }
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#keywords' do
|
90
|
+
subject { super().keywords }
|
91
|
+
it { is_expected.to be_nil }
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#duration' do
|
95
|
+
subject { super().duration }
|
96
|
+
it { is_expected.to eq 0 }
|
97
|
+
end
|
98
|
+
|
99
|
+
describe '#date' do
|
100
|
+
subject { super().date }
|
101
|
+
it { is_expected.to eq nil }
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '#thumbnail_small' do
|
105
|
+
subject { super().thumbnail_small }
|
106
|
+
thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/default.jpg'
|
107
|
+
it { is_expected.to eq thumbnail_url }
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#thumbnail_medium' do
|
111
|
+
subject { super().thumbnail_medium }
|
112
|
+
thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/mqdefault.jpg'
|
113
|
+
it { is_expected.to eq thumbnail_url }
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '#thumbnail_large' do
|
117
|
+
subject { super().thumbnail_large }
|
118
|
+
thumbnail_url = 'https://i.ytimg.com/vi/SUkXvWn1m7Q/hqdefault.jpg'
|
119
|
+
it { is_expected.to eq thumbnail_url }
|
120
|
+
end
|
121
|
+
|
122
|
+
describe '#view_count' do
|
123
|
+
subject { super().view_count }
|
124
|
+
it { is_expected.to be == 0 }
|
54
125
|
end
|
55
126
|
end
|
56
|
-
end
|
57
127
|
|
58
|
-
|
59
|
-
|
128
|
+
context 'with video removed because of copyright claim', :vcr do
|
129
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=ffClNhwx0KU') }
|
60
130
|
|
61
|
-
|
62
|
-
|
63
|
-
|
131
|
+
describe '#available?' do
|
132
|
+
subject { super().available? }
|
133
|
+
it { is_expected.to be_falsey }
|
134
|
+
end
|
64
135
|
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context 'with video mZqGqE0D0n4', :vcr do
|
139
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
65
140
|
|
66
141
|
describe '#provider' do
|
67
142
|
subject { super().provider }
|
@@ -70,472 +145,412 @@ describe VideoInfo::Providers::Youtube do
|
|
70
145
|
|
71
146
|
describe '#video_id' do
|
72
147
|
subject { super().video_id }
|
73
|
-
it { is_expected.to eq '
|
148
|
+
it { is_expected.to eq 'mZqGqE0D0n4' }
|
74
149
|
end
|
75
150
|
|
76
151
|
describe '#url' do
|
77
152
|
subject { super().url }
|
78
|
-
it { is_expected.to eq 'http://www.youtube.com/watch?v=
|
153
|
+
it { is_expected.to eq 'http://www.youtube.com/watch?v=mZqGqE0D0n4' }
|
79
154
|
end
|
80
155
|
|
81
156
|
describe '#embed_url' do
|
82
157
|
subject { super().embed_url }
|
83
|
-
it { is_expected.to eq '//www.youtube.com/embed/
|
158
|
+
it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
|
84
159
|
end
|
85
160
|
|
86
161
|
describe '#embed_code' do
|
87
162
|
subject { super().embed_code }
|
88
|
-
|
163
|
+
embed_code = '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" ' \
|
164
|
+
'frameborder="0" allowfullscreen="allowfullscreen">' \
|
165
|
+
'</iframe>'
|
166
|
+
it { is_expected.to eq embed_code }
|
167
|
+
end
|
168
|
+
|
169
|
+
describe '#author' do
|
170
|
+
subject { super().author }
|
171
|
+
it { is_expected.to eql 'Cherry Bloom' }
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#author_thumbnail' do
|
175
|
+
subject { super().author_thumbnail }
|
176
|
+
author_thumbnail = 'https://yt3.ggpht.com/-7rhnfdQaI3k/AAAAAAAAAAI/' \
|
177
|
+
'AAAAAAAAAAA/eMJZ5HBukCQ/s88-c-k-no-rj-c0xffffff' \
|
178
|
+
'/photo.jpg'
|
179
|
+
it { is_expected.to eql author_thumbnail }
|
180
|
+
end
|
181
|
+
|
182
|
+
describe '#author_url' do
|
183
|
+
subject { super().author_url }
|
184
|
+
author_url = 'https://www.youtube.com/channel/UCzxQk-rZGowoqMBKxGD5jSA'
|
185
|
+
it { is_expected.to eql author_url }
|
89
186
|
end
|
90
187
|
|
91
188
|
describe '#title' do
|
92
189
|
subject { super().title }
|
93
|
-
it { is_expected.to eq
|
190
|
+
it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
|
94
191
|
end
|
95
192
|
|
96
193
|
describe '#description' do
|
97
194
|
subject { super().description }
|
98
|
-
|
195
|
+
description = 'The first video from the upcoming album Secret Sounds,' \
|
196
|
+
' to download in-stores April 14. ' \
|
197
|
+
'Checkout http://www.cherrybloom.net'
|
198
|
+
it { is_expected.to eq description }
|
99
199
|
end
|
100
200
|
|
101
201
|
describe '#keywords' do
|
102
202
|
subject { super().keywords }
|
103
|
-
|
203
|
+
keywords_list = %w(cherry bloom king of the knife guitar
|
204
|
+
drum clip rock alternative tremplin Paris-Forum)
|
205
|
+
it { is_expected.to eq keywords_list }
|
104
206
|
end
|
105
207
|
|
106
208
|
describe '#duration' do
|
107
209
|
subject { super().duration }
|
108
|
-
it { is_expected.to eq
|
210
|
+
it { is_expected.to eq 176 }
|
211
|
+
end
|
212
|
+
|
213
|
+
describe '#width' do
|
214
|
+
subject { super().width }
|
215
|
+
it { is_expected.to be_nil }
|
216
|
+
end
|
217
|
+
|
218
|
+
describe '#height' do
|
219
|
+
subject { super().height }
|
220
|
+
it { is_expected.to be_nil }
|
109
221
|
end
|
110
222
|
|
111
223
|
describe '#date' do
|
112
224
|
subject { super().date }
|
113
|
-
|
225
|
+
|
226
|
+
it 'should return date video was posted' do
|
227
|
+
if api_key.nil?
|
228
|
+
is_expected.to eq Time.parse('Sat Apr 12 2008', Time.now.utc)
|
229
|
+
else
|
230
|
+
is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008',
|
231
|
+
Time.now.utc)
|
232
|
+
end
|
233
|
+
end
|
114
234
|
end
|
115
235
|
|
116
236
|
describe '#thumbnail_small' do
|
117
237
|
subject { super().thumbnail_small }
|
118
|
-
|
238
|
+
thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg'
|
239
|
+
it { is_expected.to eq thumbnail_url }
|
119
240
|
end
|
120
241
|
|
121
242
|
describe '#thumbnail_medium' do
|
122
243
|
subject { super().thumbnail_medium }
|
123
|
-
|
244
|
+
thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg'
|
245
|
+
it { is_expected.to eq thumbnail_url }
|
124
246
|
end
|
125
247
|
|
126
248
|
describe '#thumbnail_large' do
|
127
249
|
subject { super().thumbnail_large }
|
128
|
-
|
250
|
+
thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg'
|
251
|
+
it { is_expected.to eq thumbnail_url }
|
129
252
|
end
|
130
253
|
|
131
254
|
describe '#view_count' do
|
132
255
|
subject { super().view_count }
|
133
|
-
it { is_expected.to be
|
256
|
+
it { is_expected.to be > 4000 }
|
134
257
|
end
|
135
258
|
end
|
136
259
|
|
137
|
-
context
|
138
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=
|
260
|
+
context 'with video oQ49W_xKzKA', :vcr do
|
261
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
|
139
262
|
|
140
|
-
|
141
|
-
subject {
|
142
|
-
|
263
|
+
it 'should properly apply arbitrary url attributes' do
|
264
|
+
embed_code = subject.embed_code(url_attributes: { autoplay: 1 })
|
265
|
+
expect(embed_code).to match(/autoplay=1/)
|
143
266
|
end
|
144
267
|
end
|
145
|
-
end
|
146
268
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
describe '#provider' do
|
151
|
-
subject { super().provider }
|
152
|
-
it { is_expected.to eq 'YouTube' }
|
153
|
-
end
|
154
|
-
|
155
|
-
describe '#video_id' do
|
156
|
-
subject { super().video_id }
|
157
|
-
it { is_expected.to eq 'mZqGqE0D0n4' }
|
158
|
-
end
|
269
|
+
context 'with video oQ49W_xKzKA', :vcr do
|
270
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
|
159
271
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
describe '#embed_url' do
|
166
|
-
subject { super().embed_url }
|
167
|
-
it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
|
168
|
-
end
|
169
|
-
|
170
|
-
describe '#embed_code' do
|
171
|
-
subject { super().embed_code }
|
172
|
-
it { is_expected.to eq '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
173
|
-
end
|
174
|
-
|
175
|
-
describe '#title' do
|
176
|
-
subject { super().title }
|
177
|
-
it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
|
178
|
-
end
|
179
|
-
|
180
|
-
describe '#description' do
|
181
|
-
subject { super().description }
|
182
|
-
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' }
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '#keywords' do
|
186
|
-
subject { super().keywords }
|
187
|
-
it { is_expected.to eq %w(cherry bloom king of the knife guitar drum clip rock alternative tremplin Paris-Forum) }
|
188
|
-
end
|
189
|
-
|
190
|
-
describe '#duration' do
|
191
|
-
subject { super().duration }
|
192
|
-
it { is_expected.to eq 176 }
|
193
|
-
end
|
194
|
-
|
195
|
-
describe '#width' do
|
196
|
-
subject { super().width }
|
197
|
-
it { is_expected.to be_nil }
|
198
|
-
end
|
199
|
-
|
200
|
-
describe '#height' do
|
201
|
-
subject { super().height }
|
202
|
-
it { is_expected.to be_nil }
|
203
|
-
end
|
204
|
-
|
205
|
-
describe '#date' do
|
206
|
-
subject { super().date }
|
207
|
-
it { is_expected.to eq Time.parse('Sat Apr 12 2008', Time.now.utc) }
|
208
|
-
end
|
209
|
-
|
210
|
-
describe '#thumbnail_small' do
|
211
|
-
subject { super().thumbnail_small }
|
212
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg' }
|
213
|
-
end
|
214
|
-
|
215
|
-
describe '#thumbnail_medium' do
|
216
|
-
subject { super().thumbnail_medium }
|
217
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg' }
|
218
|
-
end
|
219
|
-
|
220
|
-
describe '#thumbnail_large' do
|
221
|
-
subject { super().thumbnail_large }
|
222
|
-
it { is_expected.to eq 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg' }
|
223
|
-
end
|
224
|
-
|
225
|
-
describe '#view_count' do
|
226
|
-
subject { super().view_count }
|
227
|
-
it { is_expected.to be > 4000 }
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
context "with video oQ49W_xKzKA", :vcr do
|
232
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
|
233
|
-
|
234
|
-
it { expect(subject.embed_code(url_attributes: { autoplay: 1 })).to match(/autoplay=1/) }
|
235
|
-
end
|
236
|
-
|
237
|
-
context "with video oQ49W_xKzKA", :vcr do
|
238
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
|
239
|
-
|
240
|
-
describe '#provider' do
|
241
|
-
subject { super().provider }
|
242
|
-
it { is_expected.to eq 'YouTube' }
|
243
|
-
end
|
244
|
-
|
245
|
-
describe '#video_id' do
|
246
|
-
subject { super().video_id }
|
247
|
-
it { is_expected.to eq 'oQ49W_xKzKA' }
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
context "with video Xp6CXF-Cesg", :vcr do
|
252
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=Xp6CXF-Cesg') }
|
253
|
-
|
254
|
-
describe '#provider' do
|
255
|
-
subject { super().provider }
|
256
|
-
it { is_expected.to eq 'YouTube' }
|
257
|
-
end
|
258
|
-
|
259
|
-
describe '#video_id' do
|
260
|
-
subject { super().video_id }
|
261
|
-
it { is_expected.to eq 'Xp6CXF-Cesg' }
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
context "with video VeasFckfMHY in user url", :vcr do
|
266
|
-
subject { VideoInfo.new('http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY') }
|
267
|
-
|
268
|
-
describe '#provider' do
|
269
|
-
subject { super().provider }
|
270
|
-
it { is_expected.to eq 'YouTube' }
|
271
|
-
end
|
272
|
+
describe '#provider' do
|
273
|
+
subject { super().provider }
|
274
|
+
it { is_expected.to eq 'YouTube' }
|
275
|
+
end
|
272
276
|
|
273
|
-
|
274
|
-
|
275
|
-
|
277
|
+
describe '#video_id' do
|
278
|
+
subject { super().video_id }
|
279
|
+
it { is_expected.to eq 'oQ49W_xKzKA' }
|
280
|
+
end
|
276
281
|
end
|
277
282
|
|
278
|
-
|
279
|
-
subject {
|
280
|
-
it { is_expected.to eq 'http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY' }
|
281
|
-
end
|
282
|
-
end
|
283
|
+
context 'with video Xp6CXF-Cesg', :vcr do
|
284
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=Xp6CXF-Cesg') }
|
283
285
|
|
284
|
-
|
285
|
-
|
286
|
+
describe '#provider' do
|
287
|
+
subject { super().provider }
|
288
|
+
it { is_expected.to eq 'YouTube' }
|
289
|
+
end
|
286
290
|
|
287
|
-
|
288
|
-
|
289
|
-
|
291
|
+
describe '#video_id' do
|
292
|
+
subject { super().video_id }
|
293
|
+
it { is_expected.to eq 'Xp6CXF-Cesg' }
|
294
|
+
end
|
290
295
|
end
|
291
296
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
end
|
297
|
+
context 'with video VeasFckfMHY in user url', :vcr do
|
298
|
+
video_url = 'http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY'
|
299
|
+
subject { VideoInfo.new(video_url) }
|
296
300
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
end
|
301
|
+
describe '#provider' do
|
302
|
+
subject { super().provider }
|
303
|
+
it { is_expected.to eq 'YouTube' }
|
304
|
+
end
|
302
305
|
|
303
|
-
|
304
|
-
|
306
|
+
describe '#video_id' do
|
307
|
+
subject { super().video_id }
|
308
|
+
it { is_expected.to eq 'VeasFckfMHY' }
|
309
|
+
end
|
305
310
|
|
306
|
-
|
307
|
-
|
308
|
-
|
311
|
+
describe '#url' do
|
312
|
+
subject { super().url }
|
313
|
+
it { is_expected.to eq video_url }
|
314
|
+
end
|
309
315
|
end
|
310
316
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
end
|
315
|
-
end
|
317
|
+
context 'with video VeasFckfMHY after params', :vcr do
|
318
|
+
video_url = 'http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY'
|
319
|
+
subject { VideoInfo.new(video_url) }
|
316
320
|
|
317
|
-
|
318
|
-
|
321
|
+
describe '#provider' do
|
322
|
+
subject { super().provider }
|
323
|
+
it { is_expected.to eq 'YouTube' }
|
324
|
+
end
|
319
325
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
326
|
+
describe '#video_id' do
|
327
|
+
subject { super().video_id }
|
328
|
+
it { is_expected.to eq 'VeasFckfMHY' }
|
329
|
+
end
|
324
330
|
|
325
|
-
|
326
|
-
|
327
|
-
|
331
|
+
describe '#url' do
|
332
|
+
subject { super().url }
|
333
|
+
it { is_expected.to eq video_url }
|
334
|
+
end
|
328
335
|
end
|
329
|
-
end
|
330
336
|
|
331
|
-
|
332
|
-
|
337
|
+
context 'with video VeasFckfMHY in path', :vcr do
|
338
|
+
subject { VideoInfo.new('http://www.youtube.com/v/VeasFckfMHY') }
|
333
339
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
340
|
+
describe '#provider' do
|
341
|
+
subject { super().provider }
|
342
|
+
it { is_expected.to eq 'YouTube' }
|
343
|
+
end
|
338
344
|
|
339
|
-
|
340
|
-
|
341
|
-
|
345
|
+
describe '#video_id' do
|
346
|
+
subject { super().video_id }
|
347
|
+
it { is_expected.to eq 'VeasFckfMHY' }
|
348
|
+
end
|
342
349
|
end
|
343
|
-
end
|
344
350
|
|
345
|
-
|
346
|
-
|
351
|
+
context 'with video VeasFckfMHY in e path', :vcr do
|
352
|
+
subject { VideoInfo.new('http://www.youtube.com/e/VeasFckfMHY') }
|
347
353
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
354
|
+
describe '#provider' do
|
355
|
+
subject { super().provider }
|
356
|
+
it { is_expected.to eq 'YouTube' }
|
357
|
+
end
|
352
358
|
|
353
|
-
|
354
|
-
|
355
|
-
|
359
|
+
describe '#video_id' do
|
360
|
+
subject { super().video_id }
|
361
|
+
it { is_expected.to eq 'VeasFckfMHY' }
|
362
|
+
end
|
356
363
|
end
|
357
|
-
end
|
358
364
|
|
359
|
-
|
360
|
-
|
365
|
+
context 'with video VeasFckfMHY in embed path', :vcr do
|
366
|
+
subject { VideoInfo.new('http://www.youtube.com/embed/VeasFckfMHY') }
|
361
367
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
368
|
+
describe '#provider' do
|
369
|
+
subject { super().provider }
|
370
|
+
it { is_expected.to eq 'YouTube' }
|
371
|
+
end
|
366
372
|
|
367
|
-
|
368
|
-
|
369
|
-
|
373
|
+
describe '#video_id' do
|
374
|
+
subject { super().video_id }
|
375
|
+
it { is_expected.to eq 'VeasFckfMHY' }
|
376
|
+
end
|
370
377
|
end
|
371
|
-
end
|
372
378
|
|
373
|
-
|
374
|
-
|
379
|
+
context 'with video JM9NgvjjVng in youtu.be url', :vcr do
|
380
|
+
subject { VideoInfo.new('http://youtu.be/JM9NgvjjVng') }
|
375
381
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
382
|
+
describe '#provider' do
|
383
|
+
subject { super().provider }
|
384
|
+
it { is_expected.to eq 'YouTube' }
|
385
|
+
end
|
380
386
|
|
381
|
-
|
382
|
-
|
383
|
-
|
387
|
+
describe '#video_id' do
|
388
|
+
subject { super().video_id }
|
389
|
+
it { is_expected.to eq 'JM9NgvjjVng' }
|
390
|
+
end
|
384
391
|
end
|
385
|
-
end
|
386
|
-
|
387
|
-
context "with iframe attributes", :vcr do
|
388
|
-
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
389
392
|
|
390
|
-
|
391
|
-
subject {
|
392
|
-
it { is_expected.to eq('YouTube') }
|
393
|
-
end
|
394
|
-
it { expect(subject.embed_code(iframe_attributes: { width: 800, height: 600 })).to match(/width="800"/) }
|
395
|
-
it { expect(subject.embed_code(iframe_attributes: { width: 800, height: 600 })).to match(/height="600"/) }
|
396
|
-
end
|
393
|
+
context 'without http or www', :vcr do
|
394
|
+
subject { VideoInfo.new('youtu.be/JM9NgvjjVng') }
|
397
395
|
|
398
|
-
|
399
|
-
|
396
|
+
describe '#provider' do
|
397
|
+
subject { super().provider }
|
398
|
+
it { is_expected.to eq('YouTube') }
|
399
|
+
end
|
400
400
|
|
401
|
-
|
402
|
-
|
403
|
-
|
401
|
+
describe '#video_id' do
|
402
|
+
subject { super().video_id }
|
403
|
+
it { is_expected.to eq 'JM9NgvjjVng' }
|
404
|
+
end
|
404
405
|
end
|
405
|
-
it { expect(subject.embed_code(iframe_attributes: { :'data-colorbox' => true })).to match(/data-colorbox="true"/) }
|
406
|
-
end
|
407
406
|
|
408
|
-
|
409
|
-
|
407
|
+
context 'with video url in text', :vcr do
|
408
|
+
url_in_text = '<a href="http://www.youtube.com/watch?v=mZqGqE0D0n4">' \
|
409
|
+
'http://www.youtube.com/watch?v=mZqGqE0D0n4</a>'
|
410
|
+
subject { VideoInfo.new(url_in_text) }
|
410
411
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
end
|
416
|
-
|
417
|
-
context "with full screen video URLs", :vcr do
|
418
|
-
subject { VideoInfo.new('http://www.youtube.com/v/mZqGqE0D0n4') }
|
412
|
+
describe '#provider' do
|
413
|
+
subject { super().provider }
|
414
|
+
it { is_expected.to eq('YouTube') }
|
415
|
+
end
|
419
416
|
|
420
|
-
|
421
|
-
|
422
|
-
|
417
|
+
describe '#video_id' do
|
418
|
+
subject { super().video_id }
|
419
|
+
it { is_expected.to eq('mZqGqE0D0n4') }
|
420
|
+
end
|
423
421
|
end
|
424
422
|
|
425
|
-
|
426
|
-
subject {
|
427
|
-
it { is_expected.to eq 'mZqGqE0D0n4' }
|
428
|
-
end
|
423
|
+
context 'with iframe attributes', :vcr do
|
424
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
429
425
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
426
|
+
describe '#provider' do
|
427
|
+
subject { super().provider }
|
428
|
+
it { is_expected.to eq('YouTube') }
|
429
|
+
end
|
434
430
|
|
435
|
-
|
436
|
-
|
437
|
-
|
431
|
+
it 'should properly apply dimensions attributes' do
|
432
|
+
dimensions = { width: 800, height: 600 }
|
433
|
+
embed_code = subject.embed_code(iframe_attributes: dimensions)
|
434
|
+
expect(embed_code).to match(/width="800"/)
|
435
|
+
expect(embed_code).to match(/height="600"/)
|
436
|
+
end
|
438
437
|
end
|
439
438
|
|
440
|
-
|
441
|
-
subject {
|
442
|
-
it { is_expected.to eq '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
|
443
|
-
end
|
439
|
+
context 'with arbitrary iframe_attributes', :vcr do
|
440
|
+
subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
|
444
441
|
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
442
|
+
describe '#provider' do
|
443
|
+
subject { super().provider }
|
444
|
+
it { is_expected.to eq('YouTube') }
|
445
|
+
end
|
449
446
|
|
450
|
-
|
451
|
-
|
452
|
-
|
447
|
+
it 'should properly apply arbitrary attributes' do
|
448
|
+
attributes = { :'data-colorbox' => true }
|
449
|
+
embed_code = subject.embed_code(iframe_attributes: attributes)
|
450
|
+
expect(embed_code).to match(/data-colorbox="true"/)
|
451
|
+
end
|
453
452
|
end
|
454
453
|
|
455
|
-
|
456
|
-
subject {
|
457
|
-
it { is_expected.to eq %w(cherry bloom king of the knife guitar drum clip rock alternative tremplin Paris-Forum) }
|
458
|
-
end
|
454
|
+
context 'with full screen video URLs', :vcr do
|
455
|
+
subject { VideoInfo.new('http://www.youtube.com/v/mZqGqE0D0n4') }
|
459
456
|
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
457
|
+
describe '#provider' do
|
458
|
+
subject { super().provider }
|
459
|
+
it { is_expected.to eq 'YouTube' }
|
460
|
+
end
|
464
461
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
462
|
+
describe '#video_id' do
|
463
|
+
subject { super().video_id }
|
464
|
+
it { is_expected.to eq 'mZqGqE0D0n4' }
|
465
|
+
end
|
469
466
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
467
|
+
describe '#url' do
|
468
|
+
subject { super().url }
|
469
|
+
it { is_expected.to eq 'http://www.youtube.com/v/mZqGqE0D0n4' }
|
470
|
+
end
|
474
471
|
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
472
|
+
describe '#embed_url' do
|
473
|
+
subject { super().embed_url }
|
474
|
+
it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
|
475
|
+
end
|
479
476
|
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
477
|
+
describe '#embed_code' do
|
478
|
+
subject { super().embed_code }
|
479
|
+
embed_code = '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" ' \
|
480
|
+
'frameborder="0" allowfullscreen="allowfullscreen">' \
|
481
|
+
'</iframe>'
|
482
|
+
it { is_expected.to eq embed_code }
|
483
|
+
end
|
484
484
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
485
|
+
describe '#title' do
|
486
|
+
subject { super().title }
|
487
|
+
it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
|
488
|
+
end
|
489
489
|
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
490
|
+
describe '#description' do
|
491
|
+
subject { super().description }
|
492
|
+
description = 'The first video from the upcoming album Secret Sounds,' \
|
493
|
+
' to download in-stores April 14. ' \
|
494
|
+
'Checkout http://www.cherrybloom.net'
|
495
|
+
it { is_expected.to eq description }
|
496
|
+
end
|
494
497
|
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
498
|
+
describe '#keywords' do
|
499
|
+
subject { super().keywords }
|
500
|
+
keywords_list = %w(cherry bloom king of the knife guitar
|
501
|
+
drum clip rock alternative tremplin Paris-Forum)
|
502
|
+
it { is_expected.to eq keywords_list }
|
503
|
+
end
|
500
504
|
|
505
|
+
describe '#duration' do
|
506
|
+
subject { super().duration }
|
507
|
+
it { is_expected.to eq 176 }
|
508
|
+
end
|
501
509
|
|
502
|
-
|
503
|
-
|
510
|
+
describe '#width' do
|
511
|
+
subject { super().width }
|
512
|
+
it { is_expected.to be_nil }
|
513
|
+
end
|
504
514
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
end
|
515
|
+
describe '#height' do
|
516
|
+
subject { super().height }
|
517
|
+
it { is_expected.to be_nil }
|
518
|
+
end
|
510
519
|
|
511
|
-
|
512
|
-
|
520
|
+
describe '#date' do
|
521
|
+
subject { super().date }
|
513
522
|
|
514
|
-
|
515
|
-
|
516
|
-
|
523
|
+
it 'should return date video was posted' do
|
524
|
+
if api_key.nil?
|
525
|
+
is_expected.to eq Time.parse('Sat Apr 12 2008', Time.now.utc)
|
526
|
+
else
|
527
|
+
is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008',
|
528
|
+
Time.now.utc)
|
529
|
+
end
|
530
|
+
end
|
517
531
|
end
|
518
532
|
|
519
|
-
|
520
|
-
|
533
|
+
describe '#thumbnail_small' do
|
534
|
+
subject { super().thumbnail_small }
|
535
|
+
thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg'
|
536
|
+
it { is_expected.to eq thumbnail_url }
|
521
537
|
end
|
522
538
|
|
523
|
-
|
524
|
-
|
539
|
+
describe '#thumbnail_medium' do
|
540
|
+
subject { super().thumbnail_medium }
|
541
|
+
thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg'
|
542
|
+
it { is_expected.to eq thumbnail_url }
|
525
543
|
end
|
526
|
-
end
|
527
|
-
end
|
528
|
-
|
529
|
-
context 'with valid video and OpenURI::HTTPError exception' do
|
530
|
-
subject { VideoInfo.new('https://www.youtube.com/watch?v=lExm5LELpP4') }
|
531
544
|
|
532
|
-
|
533
|
-
|
534
|
-
|
545
|
+
describe '#thumbnail_large' do
|
546
|
+
subject { super().thumbnail_large }
|
547
|
+
thumbnail_url = 'https://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg'
|
548
|
+
it { is_expected.to eq thumbnail_url }
|
535
549
|
end
|
536
550
|
|
537
|
-
|
538
|
-
|
551
|
+
describe '#view_count' do
|
552
|
+
subject { super().view_count }
|
553
|
+
it { is_expected.to be > 4000 }
|
539
554
|
end
|
540
555
|
end
|
541
556
|
end
|