video_info 2.6.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/unit_test.yml +39 -0
- data/Guardfile +1 -1
- data/README.md +10 -21
- data/lib/video_info.rb +5 -4
- data/lib/video_info/provider.rb +17 -2
- data/lib/video_info/providers/dailymotion.rb +13 -0
- data/lib/video_info/providers/vimeo_api.rb +12 -12
- data/lib/video_info/providers/vimeo_scraper.rb +66 -16
- data/lib/video_info/providers/youtube.rb +12 -0
- data/lib/video_info/providers/youtube_api.rb +12 -13
- data/lib/video_info/providers/youtube_scraper.rb +44 -25
- data/lib/video_info/providers/youtubeplaylist_api.rb +15 -1
- 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 +29 -36
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_valid_video/_available_/1_2_1_1_1.yml +29 -34
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{_description → _author}/1_3_7_1.yml +35 -39
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{_duration → _author_thumbnail}/1_3_9_1.yml +35 -39
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{_keywords → _author_url}/1_3_8_1.yml +35 -39
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_date/should_show_correct_date.yml +35 -39
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{_thumbnail_large/1_3_15_1.yml → _description/1_3_10_1.yml} +35 -39
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_duration/1_3_12_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_keywords/1_3_11_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail/1_3_21_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_large/1_3_18_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/1_3_17_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{_view_count → _thumbnail_small}/1_3_16_1.yml +35 -39
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_title/1_3_6_1.yml +34 -38
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_view_count/1_3_22_1.yml +91 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/1_2_3_1_1.yml +39 -852
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_/2_2_3_1_1.yml +30 -21
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/1_2_2_1_1.yml +45 -854
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/_available_/2_2_2_1_1.yml +30 -21
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/1_2_1_1_1.yml +45 -2579
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/_available_/2_2_1_1_1.yml +28 -79
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author/1_13_2_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author_thumbnail/1_13_3_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/author_url/1_13_4_1.yml +132 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/available_/1_13_1_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/date/1_13_7_1.yml +128 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/description/1_13_6_1.yml +131 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/duration/1_13_8_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/height/1_13_10_1.yml +131 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/keywords/1_13_9_1.yml +128 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_large/1_13_14_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_medium/1_13_13_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/thumbnail_small/1_13_12_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/title/1_13_5_1.yml +130 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/view_count/1_13_15_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_unavailable_video/width/1_13_11_1.yml +129 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/1_3_20_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/2_3_20_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/1_3_19_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/2_3_19_1.yml +85 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/1_3_21_1.yml +159 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/2_3_21_1.yml +80 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_date/should_have_correct_upload_date.yml +143 -1498
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/1_3_7_1.yml +45 -1487
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_description/2_3_7_1.yml +42 -30
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/1_3_9_1.yml +98 -1470
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_duration/2_3_9_1.yml +45 -28
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/1_3_11_1.yml +100 -1471
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_height/2_3_11_1.yml +42 -30
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_keywords/should_return_a_string_list_of_keywords.yml +144 -1499
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail/1_3_18_1.yml +236 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail/2_3_18_1.yml +82 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/1_3_15_1.yml +176 -1470
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_large/2_3_15_1.yml +43 -29
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/1_3_14_1.yml +177 -1472
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_medium/2_3_14_1.yml +43 -27
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/1_3_13_1.yml +176 -1470
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_thumbnail_small/2_3_13_1.yml +43 -27
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/1_3_6_1.yml +44 -1487
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_title/2_3_6_1.yml +45 -28
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/1_3_22_1.yml +158 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/2_3_22_1.yml +84 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/1_3_10_1.yml +99 -1473
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_width/2_3_10_1.yml +43 -29
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail/1_12_1_1.yml +234 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail/2_12_1_1.yml +78 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_large/1_12_2_1.yml +233 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_large/2_12_2_1.yml +78 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_medium/1_12_3_1.yml +235 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_medium/2_12_3_1.yml +73 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_small/1_12_4_1.yml +234 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_141349194/thumbnail_small/2_12_4_1.yml +77 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_invalid_video/_available_/1_2_2_1_1.yml +29 -25
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/_available_/with_valid_video/_available_/1_2_1_1_1.yml +31 -25
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_duration/1_4_7_1.yml +37 -32
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_height/1_4_9_1.yml +37 -32
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_large/1_4_12_1.yml +37 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_medium/1_4_11_1.yml +37 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_thumbnail_small/1_4_10_1.yml +37 -32
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_title/1_4_6_1.yml +37 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_pxonqr42is/_width/1_4_8_1.yml +37 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_duration/1_3_7_1.yml +36 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_height/1_3_9_1.yml +36 -29
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail/1_3_15_1.yml +87 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_large/1_3_12_1.yml +36 -29
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_medium/1_3_11_1.yml +36 -29
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_thumbnail_small/1_3_10_1.yml +36 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_title/1_3_6_1.yml +36 -31
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Wistia/with_video_rs1me54mpw/_width/1_3_8_1.yml +36 -29
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/1_2_2_1_1.yml +25 -482
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_available_/2_2_2_1_1.yml +82 -24
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/1_2_2_11_1.yml +24 -484
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_date/2_2_2_11_1.yml +82 -24
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/1_2_2_8_1.yml +22 -484
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_description/2_2_2_8_1.yml +82 -24
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/1_2_2_10_1.yml +23 -483
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_duration/2_2_2_10_1.yml +82 -24
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/1_2_2_9_1.yml +26 -486
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_keywords/2_2_2_9_1.yml +82 -24
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/1_2_2_7_1.yml +26 -486
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_title/2_2_2_7_1.yml +82 -24
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_2_18_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_2_18_1.yml +114 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/1_2_1_1_1.yml +25 -3896
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/_available_/2_2_1_1_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/1_2_3_1_1.yml +25 -544
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_removed_because_of_copyright_claim/_available_/2_2_3_1_1.yml +80 -83
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_a_video_without_description/_description/1_1_1_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_date/should_return_date_video_was_posted.yml +180 -3843
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/1_17_7_1.yml +20 -3968
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_description/2_17_7_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/1_17_9_1.yml +23 -3946
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_duration/2_17_9_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/1_17_8_1.yml +25 -3950
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_keywords/2_17_8_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/1_17_6_1.yml +23 -3910
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_title/2_17_6_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/1_17_17_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/2_17_17_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/1_3_6_1.yml +60 -3951
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author/2_3_6_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/1_3_7_1.yml +58 -3970
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_thumbnail/2_3_7_1.yml +272 -149
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/1_3_8_1.yml +22 -4043
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/2_3_8_1.yml +272 -149
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_author_url/can_be_called_twice_and_receive_the_same_value.yml +391 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_date/should_return_date_video_was_posted.yml +175 -3914
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/1_3_10_1.yml +25 -3957
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/2_3_10_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/1_3_12_1.yml +24 -3926
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/2_3_12_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/1_3_11_1.yml +24 -3893
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/2_3_11_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/1_3_9_1.yml +23 -3938
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/2_3_9_1.yml +153 -93
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/1_3_21_1.yml +59 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/2_3_21_1.yml +187 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/1_2_2_1_1.yml +88 -30
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/1_2_3_1_1.yml +121 -63
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/1_2_1_1_1.yml +121 -63
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/1_3_21_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/1_3_22_1.yml +274 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/1_3_23_1.yml +274 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/1_3_7_1.yml +132 -74
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/1_3_8_1.yml +132 -74
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail/1_3_18_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/1_3_15_1.yml +132 -74
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large_2x/1_3_16_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_maxres/1_3_17_1.yml +165 -0
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/1_3_14_1.yml +132 -74
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/1_3_13_1.yml +132 -74
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/1_3_6_1.yml +132 -74
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_videos/returns_list_of_videos_in_playlist.yml +79 -234
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/1_4_2_1.yml +82 -24
- data/spec/lib/video_info/providers/dailymotion_spec.rb +34 -4
- data/spec/lib/video_info/providers/vimeo_spec.rb +77 -16
- data/spec/lib/video_info/providers/wistia_spec.rb +26 -8
- data/spec/lib/video_info/providers/youtube_playlist_spec.rb +186 -176
- data/spec/lib/video_info/providers/youtube_scraper_spec.rb +14 -0
- data/spec/lib/video_info/providers/youtube_spec.rb +71 -29
- data/spec/lib/video_info_spec.rb +0 -4
- data/spec/spec_helper.rb +6 -1
- data/tmp/rspec_guard_result +25 -0
- data/video_info.gemspec +8 -8
- metadata +143 -222
- data/.travis.yml +0 -14
- data/lib/video_info/providers/vkontakte.rb +0 -194
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/1_3_14_1.yml +0 -95
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_small/1_3_13_1.yml +0 -95
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/1_3_17_1.yml +0 -1530
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author/2_3_17_1.yml +0 -68
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/1_3_16_1.yml +0 -1530
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_thumbnail/2_3_16_1.yml +0 -68
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/1_3_18_1.yml +0 -1529
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_author_url/2_3_18_1.yml +0 -68
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/1_3_19_1.yml +0 -1530
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_136971428/_view_count/2_3_19_1.yml +0 -68
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author/1_3_17_1.yml +0 -2559
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author/2_3_17_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_thumbnail/1_3_16_1.yml +0 -2559
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_thumbnail/2_3_16_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_url/1_3_18_1.yml +0 -2559
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_author_url/2_3_18_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_date/should_have_correct_upload_date.yml +0 -2714
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/1_3_7_1.yml +0 -2692
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/2_3_7_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/1_3_9_1.yml +0 -2829
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/2_3_9_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/1_3_11_1.yml +0 -2828
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/2_3_11_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_keywords/should_return_a_string_list_of_keywords.yml +0 -2716
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/1_3_15_1.yml +0 -2560
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/2_3_15_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/1_3_14_1.yml +0 -2558
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/2_3_14_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/1_3_13_1.yml +0 -2558
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/2_3_13_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/1_3_6_1.yml +0 -2961
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/2_3_6_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/1_3_19_1.yml +0 -2560
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/2_3_19_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/1_3_10_1.yml +0 -2560
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/2_3_10_1.yml +0 -159
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_hashes/available_/1_2_6_1_1.yml +0 -2996
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_invalid_video/available_/1_2_2_1_1.yml +0 -46
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_private_video/available_/1_2_3_1_1.yml +0 -865
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect/available_/1_2_4_1_1.yml +0 -666
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_redirect_to_main_page_for_auth/available_/1_2_5_1_1.yml +0 -46
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_valid_video/available_/1_2_1_1_1.yml +0 -2118
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author/1_5_14_1.yml +0 -518
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author_thumbnail/1_5_15_1.yml +0 -519
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/author_url/1_5_16_1.yml +0 -520
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/description/1_5_8_1.yml +0 -518
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/duration/1_5_10_1.yml +0 -517
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/embed_code/1_5_6_1.yml +0 -517
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/embed_url/1_5_5_1.yml +0 -519
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/height/1_5_12_1.yml +0 -517
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/title/1_5_7_1.yml +0 -517
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/view_count/1_5_13_1.yml +0 -521
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_from_kirill_lyanoi_z_video2152699_168591741_2F56fd229a9dfe2dcdbe/width/1_5_11_1.yml +0 -517
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/author/1_3_7_1.yml +0 -399
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/embed_code/1_3_6_1.yml +0 -399
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/embed_url/1_3_5_1.yml +0 -399
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_https_/vk_com/id44052340_z_video61291456_159590018_2F2521d92730a272a9ea/title/1_3_4_1.yml +0 -399
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video-54799401_165822734/title/1_7_4_1.yml +0 -682
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video3552522_171340713/embed_url/1_10_1_1.yml +0 -501
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/description/1_6_8_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/duration/1_6_10_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_code/1_6_6_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_url/1_6_5_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/height/1_6_12_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/title/1_6_7_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/view_count/1_6_13_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/width/1_6_11_1.yml +0 -449
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author/1_4_5_1.yml +0 -527
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_thumbnail/1_4_6_1.yml +0 -527
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/author_url/1_4_7_1.yml +0 -527
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_videos43640822_/video43640822_168790809/title/1_4_4_1.yml +0 -527
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/1_2_2_15_1.yml +0 -516
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_unavailable_video/_view_count/2_2_2_15_1.yml +0 -56
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/1_17_16_1.yml +0 -3948
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_full_screen_video_URLs/_view_count/2_17_16_1.yml +0 -127
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/1_3_19_1.yml +0 -3950
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/2_3_19_1.yml +0 -127
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/_available_/2_2_2_1_1.yml +0 -62
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_list_url/_available_/2_2_3_1_1.yml +0 -96
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/_available_/2_2_1_1_1.yml +0 -96
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/1_3_18_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author/2_3_18_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/1_3_19_1.yml +0 -193
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_thumbnail/2_3_19_1.yml +0 -193
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/1_3_20_1.yml +0 -193
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_author_url/2_3_20_1.yml +0 -193
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description/2_3_7_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_keywords/2_3_8_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large/2_3_15_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium/2_3_14_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/2_3_13_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/2_3_6_1.yml +0 -107
- data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_that_does_not_exist_in_embed_path/_videos/2_4_2_1.yml +0 -56
- data/spec/lib/video_info/providers/vkontakte_spec.rb +0 -242
@@ -1,6 +1,17 @@
|
|
1
1
|
class VideoInfo
|
2
2
|
module Providers
|
3
3
|
module YoutubeAPI
|
4
|
+
def available?
|
5
|
+
if !data['items'].empty?
|
6
|
+
upload_status = data['items'][0]['status']['uploadStatus']
|
7
|
+
'rejected' != upload_status
|
8
|
+
else
|
9
|
+
false
|
10
|
+
end
|
11
|
+
rescue VideoInfo::HttpError
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
4
15
|
def api_key
|
5
16
|
VideoInfo.provider_api_keys[:youtube]
|
6
17
|
end
|
@@ -46,17 +57,6 @@ class VideoInfo
|
|
46
57
|
|
47
58
|
private
|
48
59
|
|
49
|
-
def available?
|
50
|
-
if !data['items'].empty?
|
51
|
-
upload_status = data['items'][0]['status']['uploadStatus']
|
52
|
-
'rejected' != upload_status
|
53
|
-
else
|
54
|
-
false
|
55
|
-
end
|
56
|
-
rescue VideoInfo::HttpError
|
57
|
-
false
|
58
|
-
end
|
59
|
-
|
60
60
|
def _api_base
|
61
61
|
'www.googleapis.com'
|
62
62
|
end
|
@@ -83,8 +83,7 @@ class VideoInfo
|
|
83
83
|
|
84
84
|
def _channel_info
|
85
85
|
channel_url = _channel_api_url(_video_snippet['channelId'])
|
86
|
-
@
|
87
|
-
JSON.load(@channel_data.read)
|
86
|
+
@_channel_info ||= JSON.load(URI.open(channel_url).read)
|
88
87
|
end
|
89
88
|
|
90
89
|
def _channel_snippet
|
@@ -5,6 +5,14 @@ require 'net_http_timeout_errors'
|
|
5
5
|
class VideoInfo
|
6
6
|
module Providers
|
7
7
|
module YoutubeScraper
|
8
|
+
BASE_URL = "https://www.youtube.com"
|
9
|
+
CHANNEL_URL = "#{BASE_URL}/channel/"
|
10
|
+
THUMB_DEFAULT_SIZE = 88
|
11
|
+
|
12
|
+
def available?
|
13
|
+
!!title
|
14
|
+
end
|
15
|
+
|
8
16
|
def date
|
9
17
|
date = itemprop_node_value('datePublished')
|
10
18
|
|
@@ -12,20 +20,25 @@ class VideoInfo
|
|
12
20
|
end
|
13
21
|
|
14
22
|
def author
|
15
|
-
|
23
|
+
meta_node_value(channel_meta_nodes, 'og:title')
|
16
24
|
end
|
17
25
|
|
18
26
|
def author_thumbnail
|
19
|
-
|
27
|
+
image_hq_url = meta_node_value(channel_meta_nodes, 'og:image')
|
28
|
+
|
29
|
+
resize_thumb(image_hq_url, THUMB_DEFAULT_SIZE)
|
30
|
+
end
|
31
|
+
|
32
|
+
def channel_id
|
33
|
+
itemprop_node_value('channelId')
|
20
34
|
end
|
21
35
|
|
22
36
|
def author_url
|
23
|
-
|
24
|
-
'https://www.youtube.com' + path
|
37
|
+
URI.join(CHANNEL_URL, channel_id).to_s
|
25
38
|
end
|
26
39
|
|
27
40
|
def description
|
28
|
-
meta_node_value('description')
|
41
|
+
meta_node_value(video_meta_nodes, 'og:description')
|
29
42
|
end
|
30
43
|
|
31
44
|
def duration
|
@@ -39,7 +52,9 @@ class VideoInfo
|
|
39
52
|
end
|
40
53
|
|
41
54
|
def keywords
|
42
|
-
|
55
|
+
return unless available?
|
56
|
+
|
57
|
+
value = meta_node_value(video_meta_nodes, 'keywords')
|
43
58
|
|
44
59
|
value.split(', ') if value
|
45
60
|
end
|
@@ -49,37 +64,41 @@ class VideoInfo
|
|
49
64
|
end
|
50
65
|
|
51
66
|
def view_count
|
52
|
-
|
67
|
+
itemprop_node_value('interactionCount').to_i
|
53
68
|
end
|
54
69
|
|
55
70
|
private
|
56
71
|
|
57
|
-
def
|
58
|
-
@
|
72
|
+
def video_meta_nodes
|
73
|
+
@video_meta_nodes ||= data.css('meta')
|
59
74
|
end
|
60
75
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
76
|
+
def channel_meta_nodes
|
77
|
+
@channel_meta_nodes ||= channel_data.css('meta')
|
78
|
+
end
|
79
|
+
|
80
|
+
def channel_data
|
81
|
+
@channel_data ||= Oga.parse_html(URI.open(author_url).read)
|
82
|
+
end
|
64
83
|
|
65
|
-
|
84
|
+
def meta_node_value(meta_nodes=video_meta_nodes, name)
|
85
|
+
node = meta_nodes.detect do |n|
|
86
|
+
n.attr('name')&.value == name || n.attr('property')&.value == name
|
66
87
|
end
|
88
|
+
|
89
|
+
return unless node
|
90
|
+
node && node.attr('content') && node.attr('content').value
|
67
91
|
end
|
68
92
|
|
69
93
|
def itemprop_node_value(name)
|
70
|
-
|
71
|
-
|
72
|
-
itemprop_attr = m.attr('itemprop')
|
94
|
+
node = video_meta_nodes.detect do |m|
|
95
|
+
itemprop_attr = m.attr('itemprop')
|
73
96
|
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
node.attr('content').value
|
97
|
+
itemprop_attr.value == name if itemprop_attr
|
78
98
|
end
|
79
|
-
end
|
80
99
|
|
81
|
-
|
82
|
-
|
100
|
+
return unless node
|
101
|
+
node.attr('content').value
|
83
102
|
end
|
84
103
|
|
85
104
|
def _set_data_from_api_impl(api_url)
|
@@ -87,9 +106,9 @@ class VideoInfo
|
|
87
106
|
if url.include?('.com/v/')
|
88
107
|
video_id = url.split('/v/')[1].split('?')[0]
|
89
108
|
new_url = 'https://www.youtube.com/watch?v=' + video_id
|
90
|
-
Oga.parse_html(open(new_url).read)
|
109
|
+
Oga.parse_html(URI.open(new_url).read)
|
91
110
|
else
|
92
|
-
Oga.parse_html(open(api_url).read)
|
111
|
+
Oga.parse_html(URI.open(api_url).read)
|
93
112
|
end
|
94
113
|
end
|
95
114
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class VideoInfo
|
2
2
|
module YoutubePlaylistAPI
|
3
|
+
ITEMS_MAX_RESULTS = 50
|
4
|
+
|
3
5
|
def available?
|
4
6
|
!data['items'].empty?
|
5
7
|
rescue VideoInfo::HttpError
|
@@ -28,6 +30,10 @@ class VideoInfo
|
|
28
30
|
nil
|
29
31
|
end
|
30
32
|
|
33
|
+
def thumbnail
|
34
|
+
thumbnail_small
|
35
|
+
end
|
36
|
+
|
31
37
|
def thumbnail_small
|
32
38
|
_video_snippet['thumbnails']['default']['url']
|
33
39
|
end
|
@@ -40,6 +46,14 @@ class VideoInfo
|
|
40
46
|
_video_snippet['thumbnails']['high']['url']
|
41
47
|
end
|
42
48
|
|
49
|
+
def thumbnail_large_2x
|
50
|
+
_video_snippet['thumbnails']['standard']['url']
|
51
|
+
end
|
52
|
+
|
53
|
+
def thumbnail_maxres
|
54
|
+
_video_snippet['thumbnails']['maxres']['url']
|
55
|
+
end
|
56
|
+
|
43
57
|
private
|
44
58
|
|
45
59
|
def _playlist_entry
|
@@ -56,7 +70,7 @@ class VideoInfo
|
|
56
70
|
|
57
71
|
def _playlist_items_api_path
|
58
72
|
'/youtube/v3/playlistItems?part=snippet&' \
|
59
|
-
"playlistId=#{playlist_id}&fields=items&key=#{api_key}"
|
73
|
+
"playlistId=#{playlist_id}&fields=items&maxResults=#{ITEMS_MAX_RESULTS}&key=#{api_key}"
|
60
74
|
end
|
61
75
|
|
62
76
|
def _playlist_items_api_url
|
data/lib/video_info/version.rb
CHANGED
@@ -18,12 +18,18 @@ http_interactions:
|
|
18
18
|
code: 404
|
19
19
|
message: Not Found
|
20
20
|
headers:
|
21
|
+
Content-Security-Policy-Report-Only:
|
22
|
+
- 'default-src https: blob: wss: data: android-webview-video-poster: android-webview:
|
23
|
+
chrome-extension: safari-extension: ''unsafe-eval'' ''unsafe-inline''; report-uri
|
24
|
+
https://www.dailymotion.com/content_security_policy_report_uri'
|
21
25
|
Server:
|
22
26
|
- DMS/1.0.42
|
23
27
|
X-Dm-Api-Object:
|
24
28
|
- video
|
25
29
|
X-Dm-Backnode:
|
26
|
-
-
|
30
|
+
- web-118.adm.ix7.dailymotion.com:80
|
31
|
+
Vary:
|
32
|
+
- X-DM-SSL
|
27
33
|
X-Dm-Api-Method:
|
28
34
|
- info
|
29
35
|
Cache-Control:
|
@@ -33,57 +39,44 @@ http_interactions:
|
|
33
39
|
Access-Control-Expose-Headers:
|
34
40
|
- Date, X-DM-BackNode-Response-Time, X-DM-Edge, X-DM-Cache-Status, X-Served-By,
|
35
41
|
X-DM-BackNode-Response-Time
|
42
|
+
Content-Security-Policy:
|
43
|
+
- upgrade-insecure-requests
|
44
|
+
Date:
|
45
|
+
- Tue, 27 Oct 2020 10:44:15 GMT
|
36
46
|
X-Dm-Lb-Ip:
|
37
47
|
- 195.8.215.129
|
38
48
|
Expires:
|
39
49
|
- Fri, 01 Jan 2010 05:00:00 GMT
|
40
50
|
X-Dm-Lb-Name:
|
41
|
-
- lb-
|
51
|
+
- lb-03
|
42
52
|
X-Dm-Random-Number:
|
43
|
-
- '
|
53
|
+
- '8780791'
|
44
54
|
Access-Control-Allow-Origin:
|
45
55
|
- "*"
|
46
56
|
X-Dm-Backnode-Response-Time:
|
47
|
-
- '
|
57
|
+
- '31'
|
48
58
|
X-Robots-Tag:
|
49
59
|
- noindex
|
60
|
+
X-Frame-Options:
|
61
|
+
- DENY
|
62
|
+
Expect-Ct:
|
63
|
+
- max-age=0, report-uri="https://www.dailymotion.com/content_security_policy_report_uri"
|
64
|
+
X-Dm-Cache-Status:
|
65
|
+
- MISS
|
50
66
|
Access-Control-Allow-Headers:
|
51
67
|
- Content-Type, Authorization
|
52
68
|
Access-Control-Allow-Methods:
|
53
69
|
- GET, POST, DELETE
|
54
|
-
|
55
|
-
-
|
56
|
-
Via:
|
57
|
-
- 1.1 varnish
|
58
|
-
- 1.1 varnish
|
59
|
-
Fastly-Debug-Digest:
|
60
|
-
- 1f140405cf79803f1e28a389edd8ca212ce1e285b54a58fb8a17474780cac6a2
|
61
|
-
Content-Length:
|
62
|
-
- '206'
|
63
|
-
Accept-Ranges:
|
64
|
-
- bytes
|
65
|
-
Date:
|
66
|
-
- Thu, 05 May 2016 01:01:43 GMT
|
67
|
-
Age:
|
68
|
-
- '0'
|
69
|
-
Connection:
|
70
|
-
- keep-alive
|
71
|
-
X-Served-By:
|
72
|
-
- cache-fra1232-FRA, cache-sjc3135-SJC
|
73
|
-
X-Cache:
|
74
|
-
- MISS, MISS
|
75
|
-
X-Cache-Hits:
|
76
|
-
- 0, 0
|
77
|
-
Vary:
|
78
|
-
- X-DM-EC-Geo-Country
|
79
|
-
X-Dm-Cache-Status:
|
80
|
-
- MISS
|
70
|
+
Referrer-Policy:
|
71
|
+
- no-referrer-when-downgrade
|
81
72
|
X-Dm-Edge:
|
82
|
-
-
|
73
|
+
- DMParis
|
74
|
+
Content-Length:
|
75
|
+
- '265'
|
83
76
|
body:
|
84
77
|
encoding: UTF-8
|
85
78
|
string: '{"error":{"more_info":"https:\/\/developer.dailymotion.com\/api#error-codes","code":404,"message":"Can''t
|
86
|
-
find object video for `id'' parameter","type":"not_found","error_data":{"reason":"object_not_found"}}}'
|
87
|
-
http_version:
|
88
|
-
recorded_at:
|
89
|
-
recorded_with: VCR 3.0.
|
79
|
+
find object video for `id'' parameter","type":"not_found","error_data":{"reason":"object_not_found","object_type":"video","object_id":"inValIdiD","param":"id"}}}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Tue, 27 Oct 2020 10:44:15 GMT
|
82
|
+
recorded_with: VCR 3.0.3
|
@@ -18,12 +18,18 @@ http_interactions:
|
|
18
18
|
code: 200
|
19
19
|
message: OK
|
20
20
|
headers:
|
21
|
+
Content-Security-Policy-Report-Only:
|
22
|
+
- 'default-src https: blob: wss: data: android-webview-video-poster: android-webview:
|
23
|
+
chrome-extension: safari-extension: ''unsafe-eval'' ''unsafe-inline''; report-uri
|
24
|
+
https://www.dailymotion.com/content_security_policy_report_uri'
|
21
25
|
Server:
|
22
26
|
- DMS/1.0.42
|
23
27
|
X-Dm-Api-Object:
|
24
28
|
- video
|
25
29
|
X-Dm-Backnode:
|
26
|
-
-
|
30
|
+
- web-106.adm.ix7.dailymotion.com:80
|
31
|
+
Vary:
|
32
|
+
- X-DM-SSL,Accept-Encoding
|
27
33
|
X-Dm-Api-Method:
|
28
34
|
- info
|
29
35
|
Cache-Control:
|
@@ -33,60 +39,49 @@ http_interactions:
|
|
33
39
|
Access-Control-Expose-Headers:
|
34
40
|
- Date, X-DM-BackNode-Response-Time, X-DM-Edge, X-DM-Cache-Status, X-Served-By,
|
35
41
|
X-DM-BackNode-Response-Time
|
42
|
+
Content-Security-Policy:
|
43
|
+
- upgrade-insecure-requests
|
44
|
+
Date:
|
45
|
+
- Tue, 27 Oct 2020 10:44:14 GMT
|
46
|
+
Surrogate-Key:
|
47
|
+
- v-x7lni3
|
36
48
|
X-Dm-Lb-Ip:
|
37
49
|
- 195.8.215.129
|
38
50
|
X-Dm-Tg:
|
39
51
|
- v-x7lni3
|
40
52
|
X-Dm-Lb-Name:
|
41
|
-
- lb-
|
53
|
+
- lb-02
|
42
54
|
X-Dm-Random-Number:
|
43
|
-
- '
|
55
|
+
- '9659844'
|
44
56
|
Access-Control-Allow-Origin:
|
45
57
|
- "*"
|
46
58
|
X-Dm-Backnode-Response-Time:
|
47
|
-
- '
|
59
|
+
- '30'
|
48
60
|
Etag:
|
49
61
|
- W/"rQeFNlJ5iMPO8gmsSDhiVw-gzip"
|
50
62
|
X-Robots-Tag:
|
51
63
|
- noindex
|
64
|
+
X-Frame-Options:
|
65
|
+
- DENY
|
52
66
|
Last-Modified:
|
53
67
|
- Tue, 19 May 2015 07:03:39 GMT
|
68
|
+
Expect-Ct:
|
69
|
+
- max-age=0, report-uri="https://www.dailymotion.com/content_security_policy_report_uri"
|
70
|
+
X-Dm-Cache-Status:
|
71
|
+
- MISS
|
54
72
|
Access-Control-Allow-Headers:
|
55
73
|
- Content-Type, Authorization
|
56
74
|
Access-Control-Allow-Methods:
|
57
75
|
- GET, POST, DELETE
|
58
|
-
|
59
|
-
-
|
60
|
-
|
61
|
-
-
|
62
|
-
- 1.1 varnish
|
63
|
-
Fastly-Debug-Digest:
|
64
|
-
- 5156934e90466ffd0e4642c50195b7206345d38887e9d445fa00692b2f902722
|
76
|
+
Referrer-Policy:
|
77
|
+
- no-referrer-when-downgrade
|
78
|
+
X-Dm-Edge:
|
79
|
+
- DMParis
|
65
80
|
Content-Length:
|
66
81
|
- '103'
|
67
|
-
Accept-Ranges:
|
68
|
-
- bytes
|
69
|
-
Date:
|
70
|
-
- Thu, 05 May 2016 01:01:43 GMT
|
71
|
-
Age:
|
72
|
-
- '0'
|
73
|
-
Connection:
|
74
|
-
- keep-alive
|
75
|
-
X-Served-By:
|
76
|
-
- cache-fra1249-FRA, cache-sjc3125-SJC
|
77
|
-
X-Cache:
|
78
|
-
- MISS, MISS
|
79
|
-
X-Cache-Hits:
|
80
|
-
- 0, 0
|
81
|
-
Vary:
|
82
|
-
- X-DM-EC-Geo-Country, Accept-Encoding
|
83
|
-
X-Dm-Cache-Status:
|
84
|
-
- MISS
|
85
|
-
X-Dm-Edge:
|
86
|
-
- Fastly
|
87
82
|
body:
|
88
83
|
encoding: ASCII-8BIT
|
89
84
|
string: '{"id":"x7lni3","title":"Mario Kart (R\u00e9mi Gaillard)","channel":"fun","owner":"x4r137"}'
|
90
|
-
http_version:
|
91
|
-
recorded_at:
|
92
|
-
recorded_with: VCR 3.0.
|
85
|
+
http_version:
|
86
|
+
recorded_at: Tue, 27 Oct 2020 10:44:14 GMT
|
87
|
+
recorded_with: VCR 3.0.3
|
@@ -2,13 +2,13 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://api.dailymotion.com/video/x7lni3?fields=id,title,description,duration,created_time,url,views_total,tags,thumbnail_url,thumbnail_720_url,thumbnail_240_url,thumbnail_60_url
|
5
|
+
uri: https://api.dailymotion.com/video/x7lni3?fields=id,title,description,duration,created_time,url,views_total,tags,thumbnail_url,thumbnail_720_url,owner.url,owner.screenname,owner.avatar_60_url,thumbnail_240_url,thumbnail_60_url
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- VideoInfo/2.
|
11
|
+
- VideoInfo/2.8.0
|
12
12
|
Accept-Encoding:
|
13
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
14
|
Accept:
|
@@ -18,12 +18,18 @@ http_interactions:
|
|
18
18
|
code: 200
|
19
19
|
message: OK
|
20
20
|
headers:
|
21
|
+
Content-Security-Policy-Report-Only:
|
22
|
+
- 'default-src https: blob: wss: data: android-webview-video-poster: android-webview:
|
23
|
+
chrome-extension: safari-extension: ''unsafe-eval'' ''unsafe-inline''; report-uri
|
24
|
+
https://www.dailymotion.com/content_security_policy_report_uri'
|
21
25
|
Server:
|
22
26
|
- DMS/1.0.42
|
23
27
|
X-Dm-Api-Object:
|
24
28
|
- video
|
25
29
|
X-Dm-Backnode:
|
26
|
-
-
|
30
|
+
- web-071.adm.ix7.dailymotion.com:80
|
31
|
+
Vary:
|
32
|
+
- X-DM-SSL,Accept-Encoding
|
27
33
|
X-Dm-Api-Method:
|
28
34
|
- info
|
29
35
|
Cache-Control:
|
@@ -33,63 +39,53 @@ http_interactions:
|
|
33
39
|
Access-Control-Expose-Headers:
|
34
40
|
- Date, X-DM-BackNode-Response-Time, X-DM-Edge, X-DM-Cache-Status, X-Served-By,
|
35
41
|
X-DM-BackNode-Response-Time
|
42
|
+
Content-Security-Policy:
|
43
|
+
- upgrade-insecure-requests
|
44
|
+
Date:
|
45
|
+
- Tue, 27 Oct 2020 10:44:17 GMT
|
46
|
+
Surrogate-Key:
|
47
|
+
- v-x7lni3
|
36
48
|
X-Dm-Lb-Ip:
|
37
49
|
- 195.8.215.129
|
38
50
|
X-Dm-Tg:
|
39
51
|
- v-x7lni3
|
40
52
|
X-Dm-Lb-Name:
|
41
|
-
- lb-
|
53
|
+
- lb-01
|
42
54
|
X-Dm-Random-Number:
|
43
|
-
- '
|
55
|
+
- '7637990'
|
44
56
|
Access-Control-Allow-Origin:
|
45
57
|
- "*"
|
58
|
+
X-Dm-Backnode-Response-Time:
|
59
|
+
- '31'
|
46
60
|
Etag:
|
47
61
|
- W/"rQeFNlJ5iMPO8gmsSDhiVw-gzip"
|
48
62
|
X-Robots-Tag:
|
49
63
|
- noindex
|
64
|
+
X-Frame-Options:
|
65
|
+
- DENY
|
50
66
|
Last-Modified:
|
51
67
|
- Tue, 19 May 2015 07:03:39 GMT
|
68
|
+
Expect-Ct:
|
69
|
+
- max-age=0, report-uri="https://www.dailymotion.com/content_security_policy_report_uri"
|
70
|
+
X-Dm-Cache-Status:
|
71
|
+
- MISS
|
52
72
|
Access-Control-Allow-Headers:
|
53
73
|
- Content-Type, Authorization
|
54
74
|
Access-Control-Allow-Methods:
|
55
75
|
- GET, POST, DELETE
|
56
|
-
|
57
|
-
-
|
58
|
-
Via:
|
59
|
-
- 1.1 varnish
|
60
|
-
- 1.1 varnish
|
61
|
-
Fastly-Debug-Digest:
|
62
|
-
- 3553012804c358303689e11ec92c5f0012bb9c79e3360e85b4454ccedf666ef9
|
63
|
-
Content-Length:
|
64
|
-
- '441'
|
65
|
-
Accept-Ranges:
|
66
|
-
- bytes
|
67
|
-
Date:
|
68
|
-
- Thu, 05 May 2016 01:01:44 GMT
|
69
|
-
Age:
|
70
|
-
- '0'
|
71
|
-
Connection:
|
72
|
-
- keep-alive
|
73
|
-
X-Served-By:
|
74
|
-
- cache-fra1238-FRA, cache-sjc3128-SJC
|
75
|
-
X-Cache:
|
76
|
-
- MISS, HIT
|
77
|
-
X-Cache-Hits:
|
78
|
-
- 0, 1
|
79
|
-
Vary:
|
80
|
-
- X-DM-EC-Geo-Country, Accept-Encoding
|
81
|
-
X-Dm-Backnode-Response-Time:
|
82
|
-
- '0'
|
83
|
-
X-Dm-Cache-Status:
|
84
|
-
- HIT
|
76
|
+
Referrer-Policy:
|
77
|
+
- no-referrer-when-downgrade
|
85
78
|
X-Dm-Edge:
|
86
|
-
-
|
79
|
+
- DMParis
|
80
|
+
Content-Length:
|
81
|
+
- '502'
|
87
82
|
body:
|
88
83
|
encoding: ASCII-8BIT
|
89
84
|
string: '{"id":"x7lni3","title":"Mario Kart (R\u00e9mi Gaillard)","description":"Super
|
90
85
|
R\u00e9mi Kart est un jeu vid\u00e9o de course d\u00e9velopp\u00e9 et \u00e9dit\u00e9
|
91
86
|
par N''Importe Quoi TV. Sa principale originalit\u00e9 vient de sa r\u00e9alit\u00e9...<br
|
92
|
-
\/>L''aventure continue sur www.nimportequi.com","duration":136,"created_time":1228321771,"url":"
|
93
|
-
|
94
|
-
|
95
|
-
|
87
|
+
\/>L''aventure continue sur www.nimportequi.com","duration":136,"created_time":1228321771,"url":"https:\/\/www.dailymotion.com\/video\/x7lni3","views_total":10339941,"tags":["r\u00e9mi","remi","gaillard","imposteur","imposture","mario","bros","kart","nintendo","jeux"],"thumbnail_url":"https:\/\/s1.dmcdn.net\/v\/mj4x1VaO59zYd5Qm","thumbnail_720_url":"https:\/\/s1.dmcdn.net\/v\/mj4x1VaO59VyFzJt\/x720","owner.url":"https:\/\/www.dailymotion.com\/nqtv","owner.screenname":"R\u00e9mi
|
88
|
+
Gaillard","owner.avatar_60_url":"https:\/\/s2.dmcdn.net\/u\/US931VO3V-24wNr1\/60x60","thumbnail_240_url":"https:\/\/s2.dmcdn.net\/v\/mj4x1VaO59Vm42lt\/x240","thumbnail_60_url":"https:\/\/s1.dmcdn.net\/v\/mj4x1VaO59OF6TK6\/x60"}'
|
89
|
+
http_version:
|
90
|
+
recorded_at: Tue, 27 Oct 2020 10:44:17 GMT
|
91
|
+
recorded_with: VCR 3.0.3
|