@Test public final void parseTitleTest() { final String html = "<html></html>"; final LinkInformation link = new LinkInformation(); link.setUrl("http: sut.parseInformation(html, link, TEST_ACCOUNT); Assert.assertEquals(1, link.getImageUrls().size()); }
public void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId) { String videoId = ""; Pattern idPattern = Pattern.compile("^[^v]+v.(.{11}).*", Pattern.CASE_INSENSITIVE); Matcher matcher = idPattern.matcher(link.getUrl()); if (matcher.find()) { videoId = matcher.group(1); log.info("Found YouTube Video ID: " + videoId); String thumbnailUrl = "http: Set<String> thumbnails = new HashSet<String>(); thumbnails.add(thumbnailUrl); link.setImageUrls(thumbnails); link.setLargestImageUrl(thumbnailUrl); } }
YoutubeVideoThumbnailParser implements HtmlLinkInformationParserStrategy { public void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId) { String videoId = ""; Pattern idPattern = Pattern.compile("^[^v]+v.(.{11}).*", Pattern.CASE_INSENSITIVE); Matcher matcher = idPattern.matcher(link.getUrl()); if (matcher.find()) { videoId = matcher.group(1); log.info("Found YouTube Video ID: " + videoId); String thumbnailUrl = "http: Set<String> thumbnails = new HashSet<String>(); thumbnails.add(thumbnailUrl); link.setImageUrls(thumbnails); link.setLargestImageUrl(thumbnailUrl); } } }
YoutubeVideoThumbnailParser implements HtmlLinkInformationParserStrategy { public void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId) { String videoId = ""; Pattern idPattern = Pattern.compile("^[^v]+v.(.{11}).*", Pattern.CASE_INSENSITIVE); Matcher matcher = idPattern.matcher(link.getUrl()); if (matcher.find()) { videoId = matcher.group(1); log.info("Found YouTube Video ID: " + videoId); String thumbnailUrl = "http: Set<String> thumbnails = new HashSet<String>(); thumbnails.add(thumbnailUrl); link.setImageUrls(thumbnails); link.setLargestImageUrl(thumbnailUrl); } }  }
YoutubeVideoThumbnailParser implements HtmlLinkInformationParserStrategy { public void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId) { String videoId = ""; Pattern idPattern = Pattern.compile("^[^v]+v.(.{11}).*", Pattern.CASE_INSENSITIVE); Matcher matcher = idPattern.matcher(link.getUrl()); if (matcher.find()) { videoId = matcher.group(1); log.info("Found YouTube Video ID: " + videoId); String thumbnailUrl = "http: Set<String> thumbnails = new HashSet<String>(); thumbnails.add(thumbnailUrl); link.setImageUrls(thumbnails); link.setLargestImageUrl(thumbnailUrl); } }  void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId); }
YoutubeVideoThumbnailParser implements HtmlLinkInformationParserStrategy { public void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId) { String videoId = ""; Pattern idPattern = Pattern.compile("^[^v]+v.(.{11}).*", Pattern.CASE_INSENSITIVE); Matcher matcher = idPattern.matcher(link.getUrl()); if (matcher.find()) { videoId = matcher.group(1); log.info("Found YouTube Video ID: " + videoId); String thumbnailUrl = "http: Set<String> thumbnails = new HashSet<String>(); thumbnails.add(thumbnailUrl); link.setImageUrls(thumbnails); link.setLargestImageUrl(thumbnailUrl); } }  void parseInformation(final String htmlString, final LinkInformation link, final String inAccountId);  }