ofScraper-osx-001 install instructions

  1. Download http://openframeworks.cc/files/ofScraper-osx-001.zip and expand it
  2. Put libs/curl and libs/libxml2 into your OF libs folder
  3. Put ofScraper into your OF addons folder
  4. Duplicate an example project and replace the data and src folders with the src and data examples from scraperExample
  5. Open the XCode project
  6. open ofAddons.h and add
  
#ifdef OF_ADDON_USING_OFSCRAPER  
	#include "ofScraperMain.h"  
#endif  
  

  1. in your testApp.h, add the following at the top
  
#define OF_ADDON_USING_OFSCRAPER  

  1. Double click on the openFrameworks project icon on the top of your Groups & Files window (or right-click > get info)
  2. Select Configuration: All Configurations
    Collection: Search Paths
    and add the following to User Header Search Paths
  
../../libs/libxml2/include/  

  1. Done

It’s weird to me that you have to add that search path. I think I did something wrong but I can’t figure out what.

Nice!

BTW you shouldn’t have to hand add that include path.
You can just drag that folder into the xcode project side bar.

Typically we have both the addons src and the include / cpp files of the lib it is using in the sidebar -

so for example with ofXMLSettings - in the xcode side bar we have

  
ofXMLSettings/  
   src/  
       ofXMLSettings.cpp   
       ofXMLSettings.h  
   libs/  
       tinyXML.h   
       ....etc  
  

I think it is better if people keep the same approach with the addons rather than editing their config file.

Can’t wait to test it out!
I had fun using your scrapper addon to make a digg rss feed for a small lcd screen.
http://youtube.com/watch?v=AFbLbtnmy4o

Theo

I totally agree about not having to edit the XCode config file… I was trying to figure out how to make it so that I didn’t have to add a search path. I’m currently wrestling with this over in the poco thread. I guess it’s just a matter of arranging the files properly when you drag them in.

i presume that this install no longer works with xcode 3.0?

returned to 2.5, but with the following errors:

Building target “openFrameworks” of project “openFrameworks” with configuration “Debug” — (1 error)
mkdir /Users/jt/Desktop/of_preRelease_v0.05_xcode/apps/examples/XML/openFrameworksDebug.app/Contents/MacOS
cd /Users/jt/Desktop/of_preRelease_v0.05_xcode/apps/examples/XML
/Xcode2.5/usr/bin/g+±4.0 -o /Users/jt/Desktop/of_preRelease_v0.05_xcode/apps/examples/XML/openFrameworksDebug.app/Contents/MacOS/openFrameworksDebug -L/Users/jt/Desktop/of_preRelease_v0.05_xcode/apps/examples/XML -F/Users/jt/Desktop/of_preRelease_v0.05_xcode/apps/examples/XML -filelist /Users/jt/Desktop/of_preRelease_v0.05_xcode/apps/examples/XML/build/openFrameworks.build/Debug/openFrameworks.build/Objects-normal/i386/openFrameworksDebug.LinkFileList -arch i386 -Wl,-Y,1455 -mmacosx-version-min=10.4 …/…/…/libs/freetype/lib/freetype.a …/…/…/libs/freeimage/lib/freeimage.a …/…/…/libs/fmodex/lib/libfmodex.dylib …/…/…/libs/GLee/lib/GLee.a …/…/…/libs/rtAudio/lib/rtAudio.a -framework Carbon -framework GLUT -framework CoreFoundation -framework OpenGL -framework QuickTime -framework ApplicationServices -framework AudioToolbox -framework CoreAudio -framework CoreServices -framework AGL -isysroot /Xcode2.5/SDKs/MacOSX10.4u.sdk
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_htmlCreateMemoryParserCtxt
_htmlCtxtUseOptions
_htmlFreeParserCtxt
_htmlParseDocument
_xmlFreeDoc
_xmlXPathEvalExpression
_xmlXPathFreeContext
_xmlXPathFreeObject
_xmlXPathNewContext
_curl_easy_cleanup
_curl_easy_init
_curl_easy_perform
_curl_easy_setopt
_xmlFree
_xmlGetProp
_xmlHasProp
_xmlNodeGetContent

Hey!
it looks like you need to add the libcurl and libxml to the xcode project?
did you do that yet?

cheers!
Theo

hi thanks for your response theo!

i ended up resorting back to an earlier oF version, as I could not get the paths to work in pre release v0.05 using xcode 3.1 but it’s working with pre release v0.04 (i guess you guys changed the library directory structure…

anyway, not without other challenges: now i’m wondering how i can parse RSS directly… the example just crashes if i supply:

connection.getWebPageAsString(“feed://rss.news.yahoo.com/rss/topstories”);
myNode = parser.parseHtml(connection.getString());
nodes = parser.getContentOfXpathExpression(myNode,"//a");

and use get “title” instead of “href” like so:

for (int i = 0; i < nodes.size(); i++){
if (nodes[i].getHasAttribute(“title”)){
if (nodes[i].getNumChildren() == 0) {
string content = nodes[i].getContent();
verdana.drawString(content.c_str(), 100, 100 + i * 20);
ofSetColor(0xffffff);

}
}

so since this doesn’t work… i guess i need to parse xml rather than html but i’m not sure how this would work…

any help greatly appreciated!

Hey
I think

  
connection.getWebPageAsString("feed://rss.news.yahoo.com/rss/topstories");   
  

should be

  
connection.getWebPageAsString("[http://rss.news.yahoo.com/rss/topstories");](http://rss.news.yahoo.com/rss/topstories");)   
  

feed:// is a safari invention

hope that helps!
theo

has anyone been able to get this to compile in OF 005?

nevermind, wanted to load rss into OF but there’s a better way:

used this lib to get the page info as a string:
http://www.openframeworks.cc/forum/view-…-ftimestamp

it needs the poco lib, i used the OF version for xcode with it built in:
http://www.openframeworks.cc/forum/view-…-co+install

I then added the following function to the ofxXmlSettings addon to treat an xml string like any xml file:

  
  
bool ofxXmlSettings::loadString(string xmlString){	  
	bool loadOkay = doc.Parse(xmlString.c_str());  
	level = 0;  
	*storedHandle = TiXmlHandle(&doc);  
	return loadOkay;  
}  
  

Would be great to have this functionality added to the addon.
Cheers,
nay.[/i]

hi @ all,

is there also a windows support? we could just let it work on osx, would be nice if someone who has compiled this project under windows , could send his files.

thank you.