Grabs metadata and returns metadata for the given url such as title,
description and thumbnails.

@param url
The URL of the embed
@return The full embed data
192961
public Embed createEmbed(String url) {
		return getResourceFactory().getApiResource("/embed/")
				.entity(new EmbedCreate(url), MediaType.APPLICATION_JSON_TYPE)
				.post(Embed.class);
	}
453856
function getFullUrl(url, base = location.href) {
    const d = document.implementation.createHTMLDocument('');
    const b = d.createElement('base');
    const a = d.createElement('a');

    d.head.appendChild(b);
    d.body.appendChild(a);
    b.href = base;
    a.href = url;

    return a.href;
}
873363
private String getContent(String url) throws RottenTomatoesException {
        LOG.trace("Requesting: {}", url);
        try {
            final HttpGet httpGet = new HttpGet(url);
            httpGet.addHeader("accept", "application/json");
            final DigestedResponse response = DigestedResponseReader.requestContent(httpClient, httpGet, charset);

            if (response.getStatusCode() >= HTTP_STATUS_500) {
                throw new RottenTomatoesException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url);
            } else if (response.getStatusCode() >= HTTP_STATUS_300) {
                throw new RottenTomatoesException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url);
            }

            return response.getContent();
        } catch (IOException ex) {
            throw new RottenTomatoesException(ApiExceptionType.CONNECTION_ERROR, "Error retrieving URL", url, ex);
        }
    }
1335242
public static String read(URL url) throws IOException, NotFoundException {
        BufferedImage image = ImageIO.read(url);
        return read(image);
    }
475764
public static String getContent(String stringUrl, Map<String, String> parameters)
      throws IOException {
    return getContent(stringUrl, parameters, null);
  }
49111
public static byte[] loadBytes(URL url) {
        byte[] bytes = null;
        try {
            bytes = loadBytes(url.openStream());
        } catch (IOException ex) {
            // ex.printStackTrace();
        }
        return bytes;
    }
67392
public static byte[] getURLData(final String url) {
        final int readBytes = 1000;

        URL u;
        InputStream is = null;
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();

        // See http://www.exampledepot.com/egs/javax.net.ssl/TrustAll.html

        // Create a trust manager that does not validate certificate chains
        final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return null;
            }

            public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
            }

            public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
            }
        }};

        // Install the all-trusting trust manager
        // FIXME from Lee: This doesn't seem like a wise idea to install an all-trusting cert manager by default
        try {
            final SSLContext sc = SSLContext.getInstance("SSL");
            sc.init(null, trustAllCerts, new java.security.SecureRandom());
            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
        } catch (final Exception ex) {
            LOG.error("Unable to install the all-trust SSL Manager", ex);
        }

        try {
            u = new URL(url);
            is = u.openStream(); // throws an IOException

            int nRead;
            byte[] data = new byte[readBytes];

            while ((nRead = is.read(data, 0, readBytes)) != -1) {
                buffer.write(data, 0, nRead);
            }
        } catch (final Exception ex) {
            LOG.error("Unable to read data from URL", ex);
        } finally {
            try {
                buffer.flush();

                if (is != null) is.close();
            } catch (final Exception ex) {
                LOG.error("Unable to flush and close URL Input Stream", ex);
            }
        }

        return buffer.toByteArray();
    }
402680
private static long getFileSizeFromUrl(String url) {
        if (!url.toLowerCase().startsWith("http")) {
            return -1;
        }

        final Request request = new Request.Builder().url(url).head().build();
        long respLength = -1;
        try (Response response = MVHttpClient.getInstance().getReducedTimeOutClient().newCall(request).execute();
             ResponseBody body = response.body()) {
            if (response.isSuccessful())
                respLength = body.contentLength();
        } catch (IOException ignored) {
            respLength = -1;
        }

        if (respLength < 1_000_000) {
            // alles unter 1MB sind Playlisten, ORF: Trailer bei im Ausland gesperrten Filmen, ...
            // dann wars nix
            respLength = -1;
        }
        return respLength;
    }
12750
public static RequestMetadata getRequestMetadata() {
        RequestMetadata metadata = threadLocal.get();
        if (metadata == null)
            metadata = getNoMetadata();
        return metadata;
    }
548557
public static org.jsoup.nodes.Document getDocumentFromUrl(String url) throws IOException {
        return Jsoup.connect(url).get();
    }
20705
public static byte[] getBytes(URL url) throws IOException {
        final String path = url.getPath();
        final File file = new File(path);
        if (file.exists()) {
            return getFileBytes(file);
        }

        return null;
    }
1045993
public static String getContent(String stringUrl) {
    if (stringUrl.equalsIgnoreCase("clipboard")) {
      try {
        return getFromClipboard();
      } catch (Exception e) {
        //it's ok.
      }
    }
    return getContent(stringUrl, null);
  }
70036
protected synchronized Document getHttpDocument(String url) 
   	throws IOException, SAXException {
   	
       Document d = null;
       d = this.builder.parse(url);
       return d;
   }
301287
protected final MetaProperties getMetaFile(String url) throws UpdateException {
        try {
            final String metaUrl = url.substring(0, url.length() - 7) + "meta";
            final URL u = new URL(metaUrl);
            final Downloader d = new Downloader(settings);
            final String content = d.fetchContent(u, true);
            return new MetaProperties(content);
        } catch (MalformedURLException ex) {
            throw new UpdateException("Meta file url is invalid: " + url, ex);
        } catch (InvalidDataException ex) {
            throw new UpdateException("Meta file content is invalid: " + url, ex);
        } catch (DownloadFailedException ex) {
            throw new UpdateException("Unable to download meta file: " + url, ex);
        }
    }
1183540
public static String getTarballResourceNameFromUrl(String url) {
        String resourceName = url.substring(url.lastIndexOf('/') + 1);
        return resourceName;
    }
969449
public static HttpUrl parse(String url) {
        Builder builder = new Builder();
        Builder.ParseResult result = builder.parse(null, url);
        return result == Builder.ParseResult.SUCCESS ? builder.build() : null;
    }
966099
public static Meta fromUrl(URL url) {
        InputStream stream = null;
        try {
            stream = url.openStream();
            Gson gson = new GsonBuilder().registerTypeAdapter(PropertyForm.class, new TypeAdapter<PropertyForm>() {
                    @Override
                    public void write(JsonWriter out, PropertyForm value) throws IOException {
                        out.value(value.name().toLowerCase());
                    }

                    @Override
                    public PropertyForm read(JsonReader in) throws IOException {
                        return PropertyForm.valueOf(in.nextString().toUpperCase());
                    }
                }).create();
            Map<String, Type> types = gson.fromJson(
                    new InputStreamReader(stream),
                    new TypeToken<Map<String, Type>>(){ }.getType()
            );
            return new Meta(types);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (stream != null) {
                try { stream.close(); } catch (Exception e) { }
            }
        }
    }