|
Project Information
Featured
|
Java Wrapper for Topsy Social Search API
Search Example: Search searchTopsy = new Search();
searchTopsy.setTopsyConfig(config);
SearchResponse results = null;
try {
SearchCriteria criteria = new SearchCriteria();
criteria.setQuery("Maruti Gollapudi");
results = searchTopsy.search(criteria);
System.out.println(results.getResult().getList().size());
System.out.println(results.getResult().getTotal());
} catch (Otter4JavaException e) {
e.printStackTrace();
}authinfo Example: AuthorInfo authorInfo = new AuthorInfo();
authorInfo.setTopsyConfig(config);
AuthorInfoResponse response = null;
try {
response = authorInfo.authorInfo("http://twitter.com/barackobama");
System.out.println(response.getResponse().getName());
System.out.println(response.getResponse().getInfluence_level());
} catch (Otter4JavaException e) {
e.printStackTrace();
}
experts sample: Experts experts = new Experts();
experts.setTopsyConfig(config);
ExpertsResponse response = null;
try{
ListParameters listParams = new ListParameters();
listParams.setPage("1");
response = experts.experts("nosql");
System.out.println(response.getResponse().getList().size());
System.out.println(response.getResponse().getTotal());
System.out.println(response.getResponse().getList().get(0).getName());
} catch (Otter4JavaException e){
e.printStackTrace();
}
Version 0.2: Current version supports: 1. Searching Topsy for a given query. 2. Crawl and download contents of search results. (Uses crawler4j to perform this). Crawls only up to first level. This version (0.2) supports only search. Sample: SearchTopsy searchTopsy = new SearchTopsy("<API KEY>");
List<Post> results = searchTopsy.search("Maruti Gollapudi", 1, 3, "a", "");;
//Use Crawler to retrieve the contents of search results
new BasicCrawlController("D:/data/crawler/out", "D:/data/topsy").crawl(results);
|