Get image URLs from HTTP document and output the results
Created: 2010-10-29 11:39:00
Last updated: 2014-02-12 11:41:59
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
![header=[] body=[This is the author information extracted from the workflow version] cssheader=[boxoverTooltipHeader] cssbody=[boxoverTooltipBody] delay=[200] Information](/images/famfamfam_silk/information.png?1680607579)
Authors (1)
![header=[] body=[These are the descriptive titles embedded within the workflow version] cssheader=[boxoverTooltipHeader] cssbody=[boxoverTooltipBody] delay=[200] Information](/images/famfamfam_silk/information.png?1680607579)
Titles (1)
Get image URLs from HTTP document and output the results |
![header=[] body=[These are the descriptions embedded within the workflow version] cssheader=[boxoverTooltipHeader] cssbody=[boxoverTooltipBody] delay=[200] Information](/images/famfamfam_silk/information.png?1680607579)
Descriptions (1)
Retrieve the web page at http://www.mygrid.org.uk, examine it for images and output the images. |
![header=[] body=[These are the listed dependencies of the workflow] cssheader=[boxoverTooltipHeader] cssbody=[boxoverTooltipBody] delay=[200] Information](/images/famfamfam_silk/information.png?1680607579)
Dependencies (0)
Processors (4)
Name |
Type |
Description |
Get_image_from_URL |
localworker |
ScriptURL inputURL = null;
if (base != void) {
inputURL = new URL(new URL(base), url);
} else {
inputURL = new URL(url);
}
byte[] contents;
if (inputURL.openConnection().getContentLength() == -1) {
// Content size unknown, must read first...
byte[] buffer = new byte[1024];
int bytesRead = 0;
int totalBytesRead = 0;
InputStream is = inputURL.openStream();
while (bytesRead != -1) {
totalBytesRead += bytesRead;
bytesRead = is.read(buffer, 0, 1024);
}
contents = new byte[totalBytesRead];
} else {
contents = new byte[inputURL.openConnection().getContentLength()];
}
int bytesRead = 0;
int totalBytesRead = 0;
InputStream is = inputURL.openStream();
while (bytesRead != -1) {
bytesRead = is.read(contents, totalBytesRead, contents.length - totalBytesRead);
totalBytesRead += bytesRead;
if (contents.length==totalBytesRead) break;
}
image = contents;
|
Get_image_URLs_from_HTTP_document |
localworker |
ScriptString lowerCaseContent = document.toLowerCase();
int index = 0;
List imagelinks = new ArrayList();
while ((index = lowerCaseContent.indexOf(" #");
String strLink = st.nextToken();
imagelinks.add(strLink);
}
|
Get_web_page_from_URL |
localworker |
ScriptURL inputURL = null;
if (base != void) {
inputURL = new URL(new URL(base), url);
}
else {
inputURL = new URL(url);
}
URLConnection con = inputURL.openConnection();
InputStream in = con.getInputStream();
InputStreamReader isr = new InputStreamReader(in);
Reader inReader = new BufferedReader(isr);
StringBuffer buf = new StringBuffer();
int ch;
while ((ch = inReader.read()) > -1) {
buf.append((char)ch);
}
inReader.close();
contents = buf.toString();
//String NEWLINE = System.getProperty("line.separator");
//
//URL inputURL = null;
//if (base != void) {
// inputURL = new URL(new URL(base), url);
//} else {
// inputURL = new URL(url);
//}
//StringBuffer result = new StringBuffer();
//BufferedReader reader = new BufferedReader(new InputStreamReader(inputURL.openStream()));
//String line = null;
//while ((line = reader.readLine()) != null) {
// result.append(line);
// result.append(NEWLINE);
//}
//
//contents = result.toString();
|
url |
stringconstant |
Valuehttp://www.mygrid.org.uk |
Outputs (2)
Name |
Description |
images |
|
image_links |
|
Datalinks (6)
Source |
Sink |
Get_image_URLs_from_HTTP_document:imagelinks |
Get_image_from_URL:url |
url:value |
Get_image_from_URL:base |
Get_web_page_from_URL:contents |
Get_image_URLs_from_HTTP_document:document |
url:value |
Get_web_page_from_URL:url |
Get_image_from_URL:image |
images |
Get_image_URLs_from_HTTP_document:imagelinks |
image_links |
Uploader
License
All versions of this Workflow are
licensed under:
Version 2 (latest)
(of 2)
Credits (0)
(People/Groups)
None
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
No comments yet
Log in to make a comment