Functions | |
QUVIcode | quvi_supported (quvi_t quvi, char *url) |
Check whether the library could parse the URL. | |
QUVIcode | quvi_supported_ident (quvi_t quvi, char *url, quvi_ident_t *ident) |
Check whether the library could parse the URL. | |
QUVIcode | quvi_ident_getprop (quvi_ident_t handle, QUVIidentProperty property,...) |
Get property information from an ident handle. | |
void | quvi_supported_ident_close (quvi_ident_t *ident) |
Close ident handle. | |
QUVIcode | quvi_next_supported_website (quvi_t quvi, char **domain, char **formats) |
Return next supported website. | |
QUVIcode | quvi_next_host (char **domain, char **formats) |
Next supported host. | |
char * | quvi_strerror (quvi_t quvi, QUVIcode code) |
Return a string describing the error code. | |
char * | quvi_version (QUVIversion type) |
Return libquvi version. | |
void | quvi_free (void *ptr) |
Free allocated memory. | |
QUVIcode | quvi_query_formats (quvi_t session, char *url, char **formats) |
Check whether the library could parse the URL.
The library checks the URL with each website script to see whether it could parse the URL. This function is designed to work without an Internet connection.
Most URL shortening services require that the URL is resolved over an Internet connection. This means that most "shortened" URLs will fail with this function (QUVI_NOSUPPORT).
quvi | Handle to session |
url | Null-terminated string to an URL |
QUVIcode quvi_supported_ident | ( | quvi_t | quvi, |
char * | url, | ||
quvi_ident_t * | ident | ||
) |
Check whether the library could parse the URL.
Identical to quvi_supported() but returns the `ident' data from a matched website script.
The library checks the URL with each website script to see whether it could parse the URL. This function is designed to work without an Internet connection.
Most URL shortening services require that the URL is resolved over an Internet connection. This means that most "shortened" URLs will fail with this function (QUVI_NOSUPPORT).
quvi | Handle to session |
url | Null-terminated string to an URL |
ident | Handle to ident data (set to NULL to emulate quvi_supported()) |
QUVIcode quvi_ident_getprop | ( | quvi_ident_t | handle, |
QUVIidentProperty | property, | ||
... | |||
) |
Get property information from an ident handle.
handle | Handle to a website script returned ident data |
property | Property ID |
... | Parameter |
Example:
quvi_ident_t ident; if (quvi_supported_ident(quvi, url, &ident) == QUVI_OK) { char *formats; quvi_ident_getprop(ident, QUVI_IDENT_PROPERTY_FORMATS, &formats); puts(formats); quvi_supported_ident_close(&ident); }
void quvi_supported_ident_close | ( | quvi_ident_t * | ident | ) |
Return next supported website.
This function can be used to iterate the supported websites.
quvi | Handle to a session |
domain | Pointer to a null-terminated string (e.g. "youtube.com") |
formats | Pointer to a null-terminated string (e.g. "default|best|hq|hd") |
Example:
while (quvi_next_supported_website(quvi, &domain, &formats) == QUVI_OK) { printf("%s\t%s\n", domain, formats); quvi_free(domain); quvi_free(formats); }
QUVIcode quvi_next_host | ( | char ** | domain, |
char ** | formats | ||
) |
Next supported host.
Iterate the list of the supported hosts.
domain | Pointer to a null-terminated string |
formats | Pointer to a null-terminated string |
Return a string describing the error code.
quvi | Handle to a libquvi session |
code | Error code |
Example:
quvi_t quvi; QUVIcode rc = quvi_init(&quvi); if (rc != QUVI_OK) { fprintf(stderr, "error: %s\n", quvi_strerror(quvi,rc)); exit (rc); } quvi_close(&quvi);
char* quvi_version | ( | QUVIversion | type | ) |
Return libquvi version.
type | Version type |
Example:
puts( quvi_version(QUVI_VERSION_LONG) );
void quvi_free | ( | void * | ptr | ) |
Free allocated memory.
ptr | Pointer to data |
Queries available formats to the URL. The query is done over an Internet connection. It resolves any shortened URLs unless QUVIOPT_NORESOLVE is set explicitly with quvi_setopt. This function checks also if an URL is supported, similarly to that quvi_supported.
Unlike quvi_supported, quvi_supported_ident and quvi_next_supported_website which all return a static format ID list as specified in the webscript’s `ident’ function, quvi_query_formats constructs the list of format IDs dynamically for each URL.
Please note that this function returns only ‘default’ to those URLs that have their corresponding webscripts handle only one (1) format. e.g. No internet connection is required in such case and a static string (‘default’) is returned to the caller instead.
session | Session handle |
url | URL (null-terminated string) |
formats | Null-terminated string (receives) |