| 1704 | } |
| 1705 | |
| 1706 | static boolean embedYouTube(Document document) { |
| 1707 | // https://developers.google.com/youtube/player_parameters |
| 1708 | // Requires: setBlockNetworkLoads and setJavaScriptEnabled |
| 1709 | boolean has = false; |
| 1710 | for (Element a : document.select("a")) |
| 1711 | if (a.attr("href").startsWith("https://www.youtube.com/embed/")) { |
| 1712 | String link = a.attr("href"); |
| 1713 | a.tagName("iframe"); |
| 1714 | a.attr("id", link.substring(link.lastIndexOf("/") + 1)); |
| 1715 | a.attr("type", "text/html"); |
| 1716 | a.attr("src", link); |
| 1717 | a.attr("frameborder", "0"); |
| 1718 | a.removeAttr("href"); |
| 1719 | if (a.text().equals(link)) |
| 1720 | a.text(""); |
| 1721 | has = true; |
| 1722 | } |
| 1723 | return has; |
| 1724 | } |
| 1725 | |
| 1726 | static void guessSchemes(Document document) { |
| 1727 | for (Element e : document.select("a,img")) |