youtube-transcript-rb 0.1.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +166 -0
- data/README.md +42 -42
- data/lib/youtube-transcript-rb.rb +4 -0
- data/lib/youtube_rb/formatters.rb +263 -0
- data/lib/youtube_rb/transcript/api.rb +144 -0
- data/lib/youtube_rb/transcript/errors.rb +215 -0
- data/lib/youtube_rb/transcript/settings.rb +26 -0
- data/lib/youtube_rb/transcript/transcript.rb +237 -0
- data/lib/youtube_rb/transcript/transcript_list.rb +168 -0
- data/lib/youtube_rb/transcript/transcript_list_fetcher.rb +220 -0
- data/lib/youtube_rb/transcript/transcript_parser.rb +81 -0
- data/lib/youtube_rb/transcript.rb +33 -0
- data/lib/youtube_rb/version.rb +5 -0
- data/sig/youtube_rb/transcript.rbs +4 -0
- data/spec/api_spec.rb +27 -27
- data/spec/errors_spec.rb +41 -41
- data/spec/formatters_spec.rb +45 -46
- data/spec/integration_spec.rb +39 -48
- data/spec/settings_spec.rb +16 -16
- data/spec/spec_helper.rb +52 -52
- data/spec/transcript_list_fetcher_spec.rb +38 -33
- data/spec/transcript_list_spec.rb +16 -19
- data/spec/transcript_parser_spec.rb +3 -3
- data/spec/transcript_spec.rb +23 -24
- metadata +17 -13
- data/lib/youtube/transcript/rb/api.rb +0 -150
- data/lib/youtube/transcript/rb/errors.rb +0 -217
- data/lib/youtube/transcript/rb/formatters.rb +0 -269
- data/lib/youtube/transcript/rb/settings.rb +0 -28
- data/lib/youtube/transcript/rb/transcript.rb +0 -239
- data/lib/youtube/transcript/rb/transcript_list.rb +0 -170
- data/lib/youtube/transcript/rb/transcript_list_fetcher.rb +0 -225
- data/lib/youtube/transcript/rb/transcript_parser.rb +0 -83
- data/lib/youtube/transcript/rb/version.rb +0 -9
- data/lib/youtube/transcript/rb.rb +0 -37
- data/sig/youtube/transcript/rb.rbs +0 -8
data/spec/integration_spec.rb
CHANGED
|
@@ -27,27 +27,25 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
27
27
|
let(:ted_talk_video_id) { "8jPQjjsBbIc" } # TED Talk - usually has good transcripts
|
|
28
28
|
let(:google_video_id) { "dQw4w9WgXcQ" } # Rick Astley - Never Gonna Give You Up (very stable)
|
|
29
29
|
|
|
30
|
-
describe
|
|
30
|
+
describe YoutubeRb::Transcript::YouTubeTranscriptApi do
|
|
31
31
|
let(:api) { described_class.new }
|
|
32
32
|
|
|
33
33
|
describe "#list" do
|
|
34
34
|
it "fetches available transcripts for a video" do
|
|
35
35
|
transcript_list = api.list(ted_talk_video_id)
|
|
36
36
|
|
|
37
|
-
expect(transcript_list).to be_a(
|
|
37
|
+
expect(transcript_list).to be_a(YoutubeRb::Transcript::TranscriptMetadataList)
|
|
38
38
|
expect(transcript_list.video_id).to eq(ted_talk_video_id)
|
|
39
39
|
expect(transcript_list.count).to be > 0
|
|
40
40
|
|
|
41
41
|
# Print available transcripts for debugging
|
|
42
|
-
puts "\nAvailable transcripts for video #{ted_talk_video_id}:"
|
|
43
|
-
puts transcript_list.to_s
|
|
44
42
|
end
|
|
45
43
|
|
|
46
44
|
it "returns a TranscriptList that is enumerable" do
|
|
47
45
|
transcript_list = api.list(ted_talk_video_id)
|
|
48
46
|
|
|
49
47
|
transcript_list.each do |transcript|
|
|
50
|
-
expect(transcript).to be_a(
|
|
48
|
+
expect(transcript).to be_a(YoutubeRb::Transcript::TranscriptMetadata)
|
|
51
49
|
expect(transcript.language_code).to be_a(String)
|
|
52
50
|
expect(transcript.language).to be_a(String)
|
|
53
51
|
end
|
|
@@ -58,18 +56,15 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
58
56
|
it "fetches English transcript by default" do
|
|
59
57
|
transcript = api.fetch(ted_talk_video_id)
|
|
60
58
|
|
|
61
|
-
expect(transcript).to be_a(
|
|
59
|
+
expect(transcript).to be_a(YoutubeRb::Transcript::FetchedTranscript)
|
|
62
60
|
expect(transcript.video_id).to eq(ted_talk_video_id)
|
|
63
61
|
expect(transcript.snippets).not_to be_empty
|
|
64
62
|
|
|
65
63
|
first_snippet = transcript.first
|
|
66
|
-
expect(first_snippet).to be_a(
|
|
64
|
+
expect(first_snippet).to be_a(YoutubeRb::Transcript::TranscriptMetadataSnippet)
|
|
67
65
|
expect(first_snippet.text).to be_a(String)
|
|
68
66
|
expect(first_snippet.start).to be_a(Float)
|
|
69
67
|
expect(first_snippet.duration).to be_a(Float)
|
|
70
|
-
|
|
71
|
-
puts "\nFetched #{transcript.length} snippets"
|
|
72
|
-
puts "First snippet: #{first_snippet.text[0..50]}..."
|
|
73
68
|
end
|
|
74
69
|
|
|
75
70
|
it "fetches transcript with specific language" do
|
|
@@ -82,17 +77,17 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
82
77
|
|
|
83
78
|
it "falls back to alternative language if primary not available" do
|
|
84
79
|
# Request Japanese first, then English as fallback
|
|
85
|
-
transcript = api.fetch(ted_talk_video_id, languages: [
|
|
80
|
+
transcript = api.fetch(ted_talk_video_id, languages: %w[ja en])
|
|
86
81
|
|
|
87
|
-
expect([
|
|
82
|
+
expect(%w[ja en]).to include(transcript.language_code)
|
|
88
83
|
expect(transcript.snippets).not_to be_empty
|
|
89
84
|
end
|
|
90
85
|
|
|
91
86
|
it "preserves HTML formatting when requested" do
|
|
92
87
|
transcript = api.fetch(ted_talk_video_id, preserve_formatting: true)
|
|
93
88
|
|
|
94
|
-
expect(transcript).to be_a(
|
|
95
|
-
#
|
|
89
|
+
expect(transcript).to be_a(YoutubeRb::Transcript::FetchedTranscript)
|
|
90
|
+
# NOTE: Not all videos have HTML formatting, so we just verify it doesn't break
|
|
96
91
|
end
|
|
97
92
|
end
|
|
98
93
|
|
|
@@ -103,7 +98,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
103
98
|
|
|
104
99
|
expect(results).to be_a(Hash)
|
|
105
100
|
expect(results.keys).to include(ted_talk_video_id)
|
|
106
|
-
expect(results[ted_talk_video_id]).to be_a(
|
|
101
|
+
expect(results[ted_talk_video_id]).to be_a(YoutubeRb::Transcript::FetchedTranscript)
|
|
107
102
|
end
|
|
108
103
|
|
|
109
104
|
it "continues on error when option is set" do
|
|
@@ -111,9 +106,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
111
106
|
errors = []
|
|
112
107
|
|
|
113
108
|
results = api.fetch_all(video_ids, continue_on_error: true) do |video_id, result|
|
|
114
|
-
if result.is_a?(StandardError)
|
|
115
|
-
errors << { video_id: video_id, error: result }
|
|
116
|
-
end
|
|
109
|
+
errors << { video_id: video_id, error: result } if result.is_a?(StandardError)
|
|
117
110
|
end
|
|
118
111
|
|
|
119
112
|
expect(results).to have_key(ted_talk_video_id)
|
|
@@ -122,12 +115,12 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
122
115
|
end
|
|
123
116
|
end
|
|
124
117
|
|
|
125
|
-
describe
|
|
118
|
+
describe YoutubeRb::Transcript do
|
|
126
119
|
describe ".fetch" do
|
|
127
120
|
it "provides convenience method for fetching transcripts" do
|
|
128
121
|
transcript = described_class.fetch(ted_talk_video_id)
|
|
129
122
|
|
|
130
|
-
expect(transcript).to be_a(
|
|
123
|
+
expect(transcript).to be_a(YoutubeRb::Transcript::FetchedTranscript)
|
|
131
124
|
expect(transcript.snippets).not_to be_empty
|
|
132
125
|
end
|
|
133
126
|
end
|
|
@@ -136,7 +129,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
136
129
|
it "provides convenience method for listing transcripts" do
|
|
137
130
|
transcript_list = described_class.list(ted_talk_video_id)
|
|
138
131
|
|
|
139
|
-
expect(transcript_list).to be_a(
|
|
132
|
+
expect(transcript_list).to be_a(YoutubeRb::Transcript::TranscriptMetadataList)
|
|
140
133
|
expect(transcript_list.count).to be > 0
|
|
141
134
|
end
|
|
142
135
|
end
|
|
@@ -144,13 +137,13 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
144
137
|
|
|
145
138
|
describe "Transcript Translation" do
|
|
146
139
|
it "translates a transcript to another language" do
|
|
147
|
-
api =
|
|
140
|
+
api = YoutubeRb::Transcript::YouTubeTranscriptApi.new
|
|
148
141
|
transcript_list = api.list(ted_talk_video_id)
|
|
149
142
|
|
|
150
143
|
# Find an English transcript
|
|
151
144
|
begin
|
|
152
145
|
transcript = transcript_list.find_transcript(["en"])
|
|
153
|
-
rescue
|
|
146
|
+
rescue YoutubeRb::Transcript::NoTranscriptFound
|
|
154
147
|
skip "No English transcript available for this video"
|
|
155
148
|
end
|
|
156
149
|
|
|
@@ -160,14 +153,12 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
160
153
|
translated = transcript.translate("es")
|
|
161
154
|
fetched = translated.fetch
|
|
162
155
|
|
|
163
|
-
expect(fetched).to be_a(
|
|
156
|
+
expect(fetched).to be_a(YoutubeRb::Transcript::FetchedTranscript)
|
|
164
157
|
expect(fetched.language_code).to eq("es")
|
|
165
158
|
expect(fetched.snippets).not_to be_empty
|
|
166
|
-
|
|
167
|
-
puts "\nTranslated to Spanish: #{fetched.first.text[0..50]}..."
|
|
168
|
-
rescue Youtube::Transcript::Rb::TranslationLanguageNotAvailable
|
|
159
|
+
rescue YoutubeRb::Transcript::TranslationLanguageNotAvailable
|
|
169
160
|
skip "Spanish translation not available for this video"
|
|
170
|
-
rescue
|
|
161
|
+
rescue YoutubeRb::Transcript::IpBlocked
|
|
171
162
|
skip "IP blocked by YouTube - try again later or use a proxy"
|
|
172
163
|
end
|
|
173
164
|
else
|
|
@@ -177,10 +168,10 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
177
168
|
end
|
|
178
169
|
|
|
179
170
|
describe "Formatters with Real Data" do
|
|
180
|
-
let(:api) {
|
|
171
|
+
let(:api) { YoutubeRb::Transcript::YouTubeTranscriptApi.new }
|
|
181
172
|
let(:transcript) { api.fetch(ted_talk_video_id) }
|
|
182
173
|
|
|
183
|
-
describe
|
|
174
|
+
describe YoutubeRb::Formatters::JSONFormatter do
|
|
184
175
|
it "formats real transcript as JSON" do
|
|
185
176
|
formatter = described_class.new
|
|
186
177
|
output = formatter.format_transcript(transcript)
|
|
@@ -192,7 +183,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
192
183
|
end
|
|
193
184
|
end
|
|
194
185
|
|
|
195
|
-
describe
|
|
186
|
+
describe YoutubeRb::Formatters::TextFormatter do
|
|
196
187
|
it "formats real transcript as plain text" do
|
|
197
188
|
formatter = described_class.new
|
|
198
189
|
output = formatter.format_transcript(transcript)
|
|
@@ -205,7 +196,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
205
196
|
end
|
|
206
197
|
end
|
|
207
198
|
|
|
208
|
-
describe
|
|
199
|
+
describe YoutubeRb::Formatters::SRTFormatter do
|
|
209
200
|
it "formats real transcript as SRT" do
|
|
210
201
|
formatter = described_class.new
|
|
211
202
|
output = formatter.format_transcript(transcript)
|
|
@@ -218,7 +209,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
218
209
|
end
|
|
219
210
|
end
|
|
220
211
|
|
|
221
|
-
describe
|
|
212
|
+
describe YoutubeRb::Formatters::WebVTTFormatter do
|
|
222
213
|
it "formats real transcript as WebVTT" do
|
|
223
214
|
formatter = described_class.new
|
|
224
215
|
output = formatter.format_transcript(transcript)
|
|
@@ -231,7 +222,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
231
222
|
end
|
|
232
223
|
end
|
|
233
224
|
|
|
234
|
-
describe
|
|
225
|
+
describe YoutubeRb::Formatters::PrettyPrintFormatter do
|
|
235
226
|
it "formats real transcript as pretty-printed output" do
|
|
236
227
|
formatter = described_class.new
|
|
237
228
|
output = formatter.format_transcript(transcript)
|
|
@@ -245,18 +236,18 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
245
236
|
end
|
|
246
237
|
|
|
247
238
|
describe "Error Handling" do
|
|
248
|
-
let(:api) {
|
|
239
|
+
let(:api) { YoutubeRb::Transcript::YouTubeTranscriptApi.new }
|
|
249
240
|
|
|
250
241
|
it "raises NoTranscriptFound for unavailable language" do
|
|
251
|
-
expect
|
|
242
|
+
expect do
|
|
252
243
|
api.fetch(ted_talk_video_id, languages: ["xx"]) # Invalid language code
|
|
253
|
-
|
|
244
|
+
end.to raise_error(YoutubeRb::Transcript::NoTranscriptFound)
|
|
254
245
|
end
|
|
255
246
|
|
|
256
247
|
it "raises appropriate error for invalid video ID" do
|
|
257
|
-
expect
|
|
248
|
+
expect do
|
|
258
249
|
api.fetch("this_is_not_a_valid_video_id_12345")
|
|
259
|
-
|
|
250
|
+
end.to raise_error(YoutubeRb::Transcript::CouldNotRetrieveTranscript)
|
|
260
251
|
end
|
|
261
252
|
|
|
262
253
|
it "raises TranscriptsDisabled for video without transcripts" do
|
|
@@ -267,7 +258,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
267
258
|
end
|
|
268
259
|
|
|
269
260
|
describe "FetchedTranscript Interface" do
|
|
270
|
-
let(:api) {
|
|
261
|
+
let(:api) { YoutubeRb::Transcript::YouTubeTranscriptApi.new }
|
|
271
262
|
let(:transcript) { api.fetch(ted_talk_video_id) }
|
|
272
263
|
|
|
273
264
|
it "is enumerable" do
|
|
@@ -275,13 +266,13 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
275
266
|
expect(transcript).to respond_to(:map)
|
|
276
267
|
expect(transcript).to respond_to(:select)
|
|
277
268
|
expect(transcript).to respond_to(:first)
|
|
278
|
-
#
|
|
279
|
-
expect(transcript.to_a.last).to be_a(
|
|
269
|
+
# NOTE: Enumerable doesn't provide #last by default, but we can use to_a.last
|
|
270
|
+
expect(transcript.to_a.last).to be_a(YoutubeRb::Transcript::TranscriptMetadataSnippet)
|
|
280
271
|
end
|
|
281
272
|
|
|
282
273
|
it "is indexable" do
|
|
283
|
-
expect(transcript[0]).to be_a(
|
|
284
|
-
expect(transcript[-1]).to be_a(
|
|
274
|
+
expect(transcript[0]).to be_a(YoutubeRb::Transcript::TranscriptMetadataSnippet)
|
|
275
|
+
expect(transcript[-1]).to be_a(YoutubeRb::Transcript::TranscriptMetadataSnippet)
|
|
285
276
|
end
|
|
286
277
|
|
|
287
278
|
it "has length" do
|
|
@@ -306,7 +297,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
306
297
|
end
|
|
307
298
|
|
|
308
299
|
describe "TranscriptList Interface" do
|
|
309
|
-
let(:api) {
|
|
300
|
+
let(:api) { YoutubeRb::Transcript::YouTubeTranscriptApi.new }
|
|
310
301
|
let(:transcript_list) { api.list(ted_talk_video_id) }
|
|
311
302
|
|
|
312
303
|
it "is enumerable" do
|
|
@@ -317,7 +308,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
317
308
|
|
|
318
309
|
it "finds transcripts by language" do
|
|
319
310
|
transcript = transcript_list.find_transcript(["en"])
|
|
320
|
-
expect(transcript).to be_a(
|
|
311
|
+
expect(transcript).to be_a(YoutubeRb::Transcript::TranscriptMetadata)
|
|
321
312
|
end
|
|
322
313
|
|
|
323
314
|
it "provides string representation" do
|
|
@@ -330,7 +321,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
330
321
|
end
|
|
331
322
|
|
|
332
323
|
describe "Transcript Object" do
|
|
333
|
-
let(:api) {
|
|
324
|
+
let(:api) { YoutubeRb::Transcript::YouTubeTranscriptApi.new }
|
|
334
325
|
let(:transcript_list) { api.list(ted_talk_video_id) }
|
|
335
326
|
let(:transcript) { transcript_list.find_transcript(["en"]) }
|
|
336
327
|
|
|
@@ -349,7 +340,7 @@ RSpec.describe "Integration Tests", :integration do
|
|
|
349
340
|
it "fetches transcript data" do
|
|
350
341
|
fetched = transcript.fetch
|
|
351
342
|
|
|
352
|
-
expect(fetched).to be_a(
|
|
343
|
+
expect(fetched).to be_a(YoutubeRb::Transcript::FetchedTranscript)
|
|
353
344
|
expect(fetched.snippets).not_to be_empty
|
|
354
345
|
end
|
|
355
346
|
|
data/spec/settings_spec.rb
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
|
-
require "
|
|
4
|
+
require "youtube_rb/transcript"
|
|
5
5
|
|
|
6
|
-
RSpec.describe "
|
|
6
|
+
RSpec.describe "YoutubeRb::Transcript Settings" do
|
|
7
7
|
describe "WATCH_URL" do
|
|
8
8
|
it "is defined" do
|
|
9
|
-
expect(
|
|
9
|
+
expect(YoutubeRb::Transcript::WATCH_URL).not_to be_nil
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "is a YouTube watch URL template" do
|
|
13
|
-
expect(
|
|
13
|
+
expect(YoutubeRb::Transcript::WATCH_URL).to include("youtube.com/watch")
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "contains video_id placeholder" do
|
|
17
|
-
expect(
|
|
17
|
+
expect(YoutubeRb::Transcript::WATCH_URL).to include("%<video_id>s")
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "can be formatted with a video_id" do
|
|
21
|
-
url = format(
|
|
21
|
+
url = format(YoutubeRb::Transcript::WATCH_URL, video_id: "abc123")
|
|
22
22
|
expect(url).to eq("https://www.youtube.com/watch?v=abc123")
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
describe "INNERTUBE_API_URL" do
|
|
27
27
|
it "is defined" do
|
|
28
|
-
expect(
|
|
28
|
+
expect(YoutubeRb::Transcript::INNERTUBE_API_URL).not_to be_nil
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "is a YouTube API URL" do
|
|
32
|
-
expect(
|
|
32
|
+
expect(YoutubeRb::Transcript::INNERTUBE_API_URL).to include("youtube.com/youtubei")
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it "contains api_key placeholder" do
|
|
36
|
-
expect(
|
|
36
|
+
expect(YoutubeRb::Transcript::INNERTUBE_API_URL).to include("%<api_key>s")
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "can be formatted with an api_key" do
|
|
40
|
-
url = format(
|
|
40
|
+
url = format(YoutubeRb::Transcript::INNERTUBE_API_URL, api_key: "my_api_key")
|
|
41
41
|
expect(url).to eq("https://www.youtube.com/youtubei/v1/player?key=my_api_key")
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
describe "INNERTUBE_CONTEXT" do
|
|
46
46
|
it "is defined" do
|
|
47
|
-
expect(
|
|
47
|
+
expect(YoutubeRb::Transcript::INNERTUBE_CONTEXT).not_to be_nil
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
it "is a frozen hash" do
|
|
51
|
-
expect(
|
|
51
|
+
expect(YoutubeRb::Transcript::INNERTUBE_CONTEXT).to be_frozen
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it "contains client configuration" do
|
|
55
|
-
expect(
|
|
55
|
+
expect(YoutubeRb::Transcript::INNERTUBE_CONTEXT).to have_key("client")
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
it "specifies clientName as ANDROID" do
|
|
59
|
-
expect(
|
|
59
|
+
expect(YoutubeRb::Transcript::INNERTUBE_CONTEXT["client"]["clientName"]).to eq("ANDROID")
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it "specifies a clientVersion" do
|
|
63
|
-
expect(
|
|
64
|
-
expect(
|
|
63
|
+
expect(YoutubeRb::Transcript::INNERTUBE_CONTEXT["client"]["clientVersion"]).not_to be_nil
|
|
64
|
+
expect(YoutubeRb::Transcript::INNERTUBE_CONTEXT["client"]["clientVersion"]).to be_a(String)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
2
4
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
5
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
16
18
|
|
|
17
19
|
require "bundler/setup"
|
|
18
|
-
require "
|
|
20
|
+
require "youtube_rb/transcript"
|
|
19
21
|
require "webmock/rspec"
|
|
20
22
|
require "faraday"
|
|
21
23
|
|
|
@@ -55,55 +57,53 @@ RSpec.configure do |config|
|
|
|
55
57
|
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
56
58
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
57
59
|
|
|
58
|
-
# The settings below are suggested to provide a good initial experience
|
|
59
|
-
# with RSpec, but feel free to customize to your heart's content.
|
|
60
|
-
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
#
|
|
98
|
-
#
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
-
Kernel.srand config.seed
|
|
108
|
-
=end
|
|
60
|
+
# The settings below are suggested to provide a good initial experience
|
|
61
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
62
|
+
# # This allows you to limit a spec run to individual examples or groups
|
|
63
|
+
# # you care about by tagging them with `:focus` metadata. When nothing
|
|
64
|
+
# # is tagged with `:focus`, all examples get run. RSpec also provides
|
|
65
|
+
# # aliases for `it`, `describe`, and `context` that include `:focus`
|
|
66
|
+
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
67
|
+
# config.filter_run_when_matching :focus
|
|
68
|
+
#
|
|
69
|
+
# # Allows RSpec to persist some state between runs in order to support
|
|
70
|
+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
71
|
+
# # you configure your source control system to ignore this file.
|
|
72
|
+
# config.example_status_persistence_file_path = "spec/examples.txt"
|
|
73
|
+
#
|
|
74
|
+
# # Limits the available syntax to the non-monkey patched syntax that is
|
|
75
|
+
# # recommended. For more details, see:
|
|
76
|
+
# # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
|
77
|
+
# config.disable_monkey_patching!
|
|
78
|
+
#
|
|
79
|
+
# # This setting enables warnings. It's recommended, but in some cases may
|
|
80
|
+
# # be too noisy due to issues in dependencies.
|
|
81
|
+
# config.warnings = true
|
|
82
|
+
#
|
|
83
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
|
84
|
+
# # file, and it's useful to allow more verbose output when running an
|
|
85
|
+
# # individual spec file.
|
|
86
|
+
# if config.files_to_run.one?
|
|
87
|
+
# # Use the documentation formatter for detailed output,
|
|
88
|
+
# # unless a formatter has already been configured
|
|
89
|
+
# # (e.g. via a command-line flag).
|
|
90
|
+
# config.default_formatter = "doc"
|
|
91
|
+
# end
|
|
92
|
+
#
|
|
93
|
+
# # Print the 10 slowest examples and example groups at the
|
|
94
|
+
# # end of the spec run, to help surface which specs are running
|
|
95
|
+
# # particularly slow.
|
|
96
|
+
# config.profile_examples = 10
|
|
97
|
+
#
|
|
98
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
|
99
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
|
100
|
+
# # the seed, which is printed after each run.
|
|
101
|
+
# # --seed 1234
|
|
102
|
+
# config.order = :random
|
|
103
|
+
#
|
|
104
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
|
105
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
|
106
|
+
# # test failures related to randomization by passing the same `--seed` value
|
|
107
|
+
# # as the one that triggered the failure.
|
|
108
|
+
# Kernel.srand config.seed
|
|
109
109
|
end
|