OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.distiller.extractors.embeds; | 5 package org.chromium.distiller.extractors.embeds; |
6 | 6 |
7 import org.chromium.distiller.DomUtil; | 7 import org.chromium.distiller.DomUtil; |
8 import org.chromium.distiller.LogUtil; | 8 import org.chromium.distiller.LogUtil; |
9 import org.chromium.distiller.webdocument.WebEmbed; | 9 import org.chromium.distiller.webdocument.WebEmbed; |
10 | 10 |
11 import com.google.gwt.dom.client.AnchorElement; | 11 import com.google.gwt.dom.client.AnchorElement; |
12 import com.google.gwt.dom.client.Document; | 12 import com.google.gwt.dom.client.Document; |
13 import com.google.gwt.dom.client.Element; | 13 import com.google.gwt.dom.client.Element; |
14 import com.google.gwt.dom.client.IFrameElement; | 14 import com.google.gwt.dom.client.IFrameElement; |
15 import com.google.gwt.dom.client.NodeList; | 15 import com.google.gwt.dom.client.NodeList; |
16 | 16 |
17 import java.util.HashMap; | |
18 import java.util.HashSet; | 17 import java.util.HashSet; |
19 import java.util.Map; | |
20 import java.util.Set; | 18 import java.util.Set; |
21 | 19 |
22 /** | 20 /** |
23 * TwitterExtractor is used to look for Twitter embeds. This class looks for bot
h rendered and | 21 * TwitterExtractor is used to look for Twitter embeds. This class looks for bot
h rendered and |
24 * unrendered tweets since distillation may happen before or after that particul
ar javascript runs. | 22 * unrendered tweets since distillation may happen before or after that particul
ar javascript runs. |
25 */ | 23 */ |
26 public class TwitterExtractor implements EmbedExtractor { | 24 public class TwitterExtractor implements EmbedExtractor { |
27 | 25 |
28 private static final Set<String> relevantTags = new HashSet<>(); | 26 private static final Set<String> relevantTags = new HashSet<>(); |
29 static { | 27 static { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 137 |
140 String id = tweetBlock.getAttribute("data-tweet-id"); | 138 String id = tweetBlock.getAttribute("data-tweet-id"); |
141 | 139 |
142 if (id.isEmpty()) { | 140 if (id.isEmpty()) { |
143 return null; | 141 return null; |
144 } | 142 } |
145 | 143 |
146 return new WebEmbed(e, "twitter", id, null); | 144 return new WebEmbed(e, "twitter", id, null); |
147 } | 145 } |
148 } | 146 } |
OLD | NEW |