### Question:
YouTubeSearcher extends AbstractMultifacetSearcher<WebVideo> { public String getCaptions(String videoId, boolean asXml) { DocumentRetriever simpleRetriever = new DocumentRetriever(); WebDocumentRetriever retriever = new RenderingDocumentRetriever(); Document webDocument = retriever.getWebDocument("https: String text = HtmlHelper.getInnerXml(webDocument); String url = StringHelper.getSubstringBetween(text, "api\\/timedtext", "\\\""); if (url.isEmpty()) { return ""; } url = url.replace("\\\\u0026","&"); url = "https: String xml = Optional.ofNullable(simpleRetriever.getText(url)).orElse(""); if (asXml) { return xml; } xml = HtmlHelper.stripHtmlTags(xml," "); xml = xml.replaceAll("\\[.*?\\]", ""); xml = xml.replaceAll("\\n", " "); xml = StringHelper.clean(xml); return xml; } YouTubeSearcher(String apiKey);  YouTubeSearcher(Configuration configuration); @Override String getName(); SearchResults<WebVideo> getVideosFromPlaylists(String playlistId); List<WebVideo> getVideos(List<String> videoIds); String getCaptions(String videoId, boolean asXml); List<VideoPlaylist> getPlaylists(String channelId); @Override SearchResults<WebVideo> search(MultifacetQuery query); static final String SEARCHER_NAME; static final String CONFIG_API_KEY; }### Answer:
@Ignore @Test public void getCaptions() { YouTubeSearcher youTubeSearcher = new YouTubeSearcher("notneedednow"); String captions = youTubeSearcher.getCaptions("BCrQD7rjEro", true); collector.checkThat(captions, Matchers.containsString("verschrauben das alles mit der")); captions = youTubeSearcher.getCaptions("BCrQD7rjEro", false); collector.checkThat(captions, Matchers.containsString("verschrauben das alles mit der")); }