Last active
February 27, 2016 21:10
-
-
Save karlosmid/61700c227478492c5ae6 to your computer and use it in GitHub Desktop.
Get youtube video subtitles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Then /^I see lessons with albanian subtitle$/ do | |
| HOST = 'www.googleapis.com' | |
| PATH = '/youtube/v3/captions' | |
| PART = 'snippet' | |
| on(YoutubePage).first_lesson_in_grid_element.when_visible(@app['PAGE_TIMEOUT']).click | |
| youtube_video_id = @browser.element(:tag_name, 'iframe').attribute_value('data-video-id') | |
| youtube_client = HTTPClient.new | |
| response = JSON.parse youtube_client.get("https://#{HOST}#{PATH}?key=#{@app['GOOGLE_API_KEY']}&part=#{PART}&videoId=#{youtube_video_id}").body | |
| pass = false | |
| response['items'].each {|item| | |
| if item['snippet']['language'] == 'sq' | |
| pass = true | |
| break | |
| end | |
| } | |
| expect(pass).to be_truthy | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment