With
Jsoup you can get the HTML source of a website. After that, it's easy to get the images or video's. I believe the only exception is animated gif and certain video files like avi/wmv. Processing does not display those. You can however retrieve those files and store them on your computer and watch them outside of Processing.
Also, after some searching in this forum, i found :
https://forum.processing.org/topic/load-image-from-web-13-7-2012
- import org.jsoup.*;
- import org.jsoup.parser.*;
- import org.jsoup.select.*;
- import org.jsoup.nodes.*;
- Document doc;
- URL url;
- URI uri;
- void setup() {
- println(extracturl("http://www.flickr.com/groups/landcape/pool/"));
- }
- String[] extracturl(String s) {
- try {
- doc = Jsoup.connect(s).get();
- }
- catch (IOException ex) {
- println(ex);
- }
- Elements imageElement = doc.select("img[src]");
-
- // remove everything except the url
- String[] imgUrl = new String[imageElement.size()];
- int count = 0;
- for (Iterator<Element> i = imageElement.iterator(); i.hasNext();) {
- Element e = i.next();
- if (e.attr("src").contains("http"))
- imgUrl[count++] = e.attr("src");
- else { // retrieve the full url
- try {
- url = new URL(s);
- }
- catch (MalformedURLException ex) {
- println(ex);
- }
- try {
- uri = url.toURI();
- }
- catch (URISyntaxException ex) {
- println(ex);
- }
- imgUrl[count++] = uri.resolve(e.attr("src")).toString();
- }
- e.remove();
- }
- return imgUrl;
- }