libscipaper 1.0.x
|
This API provides the external functionality required to use libscipaper in your application to get document metadata as well as full text.
The gist of the API to query a paper or multiple papers is:
Usually the default behavior of scipaper returning the result from the first backend that matches your query is what you want, but if this is not what you want, you can specify a backend for libscipaper to use by setting the backendId variable in your DocumentMeta query struct to the id of a backend found with sci_get_all_backends() or sci_backend_get_id_by_name()
Full API documentation can be found here: User API
#include <stdio.h> #include <stdbool.h> #include <scipaper/scipaper.h> #define MAX_RESULTS 200 int main(int argc, char** argv) { bool ret = sci_paper_init(NULL, NULL, 0); if(!ret) { printf("Could not init libscipaper"); return 1; } char doi[] = "10.1109/DSP-SPE.2011.5739265"; DocumentMeta meta; meta.doi = doi; RequestReturn* filledMetas = sci_fill_meta(&meta, NULL, MAX_RESULTS, 0); if(filledMetas) { printf("Found %i documents that match\n", filledMetas->count); printf("Found document with doi of: %s\n", doi); if(filledMetas->documents[0]->title) printf("Title: %s\n", filledMetas->documents[0]->title); if(filledMetas->documents[0]->author) printf("Author: %s\n", filledMetas->documents[0]->author); if(filledMetas->documents[0]->journal) printf("Journal: %s\n", filledMetas->documents[0]->journal); bool saved = sci_save_document_to_pdf(filledMetas->documents[0], "out.pdf"); if(saved) printf("Was able to save pdf of document\n"); else printf("Was not able to save pdf of document\n"); } else { printf("Unable to find document with doi of: %s\n", doi); } request_return_free(filledMetas); sci_paper_exit(); return 0; }