Get RSS information -> XML error
in
Contributed Library Questions
•
1 year ago
Hello everyone,
I'm new on processing and scripting to.
I trie to get rss informations with processing and to convert them into osc.
For the moment is my code, but it doesn't work and I don't understand why !
Processing ask me to "define an explicit constructor" but I don't understand what is it...
If you can help me, your welcome :)
I use oscP5 library.
Thanks !
PAx
------------------
// Load RSS feed
String url = "http://rss.liberation.fr/rss/9/"; // Type here the RSS URL
XML rss = new XML(this, url);
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
// Get title of each element
// Global setup
void setup() {
oscP5 = new OscP5(this,12000);
myRemoteLocation = new NetAddress("127.0.0.1",9000); //select here the IP address and the port number
}
void draw() {
XMLElement[] titleXMLElements = rss.getChildren("channel/item/title");
for (int i = 0; i < titleXMLElements.length; i++)
{
String title = titleXMLElements[i].getContent();
println(i + ": " + title.length());
OscMessage myMessage = new OscMessage("/rss/title/length");
myMessage.add(title.length()); /* add an int to the osc message */
oscP5.send(myMessage, myRemoteLocation);
delay(1000);
}
}
1