List of usage examples for com.google.gwt.dom.client IFrameElement getSrc
public String getSrc()
From source file:org.chromium.distiller.extractors.embeds.TwitterExtractor.java
License:Open Source License
/** * Handle a Twitter embed that has already been rendered. * @param e The root element of the embed (should be an "iframe"). * @return EmbeddedElement object representing the embed or null. *//*from w ww. ja v a 2 s . c o m*/ private WebEmbed handleRendered(Element e) { // Twitter embeds are blockquote tags operated on by some javascript. if (!"IFRAME".equals(e.getTagName())) { return null; } IFrameElement iframe = IFrameElement.as(e); // If the iframe has no "src" attribute, explore further. if (!iframe.getSrc().isEmpty()) { return null; } Document iframeDoc = iframe.getContentDocument(); if (iframeDoc == null) { return null; } // The iframe will contain a blockquote element that has information including tweet id. NodeList blocks = iframeDoc.getElementsByTagName("blockquote"); if (blocks.getLength() < 1) { return null; } Element tweetBlock = Element.as(blocks.getItem(0)); String id = tweetBlock.getAttribute("data-tweet-id"); if (id.isEmpty()) { return null; } return new WebEmbed(e, "twitter", id, null); }