ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_extract.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <stddef.h>
18#include <stdint.h>
19
20#include "ra8_err.h"
21
23typedef enum : uint16_t {
27
29typedef struct {
31 size_t count;
33
35typedef enum : uint16_t {
39
50typedef struct {
53} mdl_hit_t;
54
73
99bool mdl_extract_resolve_url(const char* base, const char* raw, char* out, size_t out_cap);
100
131ra8_err_t mdl_extract_selector(const char* html,
132 size_t html_len,
133 const char* selector,
134 char* out,
135 size_t out_cap);
136
165ra8_err_t mdl_extract_images(const char* html,
166 size_t html_len,
167 const char* base_url,
168 const char* prefer_attr,
169 const char* url_contains,
170 mdl_url_list_t* out);
171
196ra8_err_t mdl_extract_anchors(const char* html,
197 size_t html_len,
198 const char* base_url,
199 const char* href_contains,
200 mdl_url_list_t* out);
201
242ra8_err_t mdl_extract_hits(const char* html,
243 size_t html_len,
244 const char* base_url,
245 const char* url_contains,
246 mdl_hit_list_t* out);
ra8_err_t mdl_extract_anchors(const char *html, size_t html_len, const char *base_url, const char *href_contains, mdl_url_list_t *out)
Scan html for <a href> links, resolved to absolute form.
ra8_err_t mdl_extract_images(const char *html, size_t html_len, const char *base_url, const char *prefer_attr, const char *url_contains, mdl_url_list_t *out)
Scan html for <img> image URLs, resolved to absolute form.
mdl_hit_limits_t
Fixed capacities for a titled-anchor hit list (search/browse).
Definition mdl_extract.h:35
@ k_mdl_max_hits
Max titled hits captured per results page.
Definition mdl_extract.h:36
@ k_mdl_hit_title_max
Max title bytes per hit, including the NUL.
Definition mdl_extract.h:37
mdl_extract_limits_t
Fixed capacities for an extracted URL list (zero dynamic alloc).
Definition mdl_extract.h:23
@ k_mdl_url_max
Max bytes per URL, including the NUL.
Definition mdl_extract.h:25
@ k_mdl_max_urls
Max URLs captured per page (chapters or images).
Definition mdl_extract.h:24
bool mdl_extract_resolve_url(const char *base, const char *raw, char *out, size_t out_cap)
Resolve a possibly relative HTTP(S) URL against an absolute base URL.
ra8_err_t mdl_extract_hits(const char *html, size_t html_len, const char *base_url, const char *url_contains, mdl_hit_list_t *out)
Scan html for <a href> links, keeping each hit's title and URL.
ra8_err_t mdl_extract_selector(const char *html, size_t html_len, const char *selector, char *out, size_t out_cap)
Extract one bounded metadata value using a site-descriptor selector.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Bounded list of titled hits plus the raw anchor tally.
Definition mdl_extract.h:68
mdl_hit_t hits[k_mdl_max_hits]
Deduplicated titled hits.
Definition mdl_extract.h:69
size_t count
Number of valid hits.
Definition mdl_extract.h:70
size_t anchors_seen
Total resolvable <a href> anchors.
Definition mdl_extract.h:71
One discovery hit: a human-facing title paired with a series URL.
Definition mdl_extract.h:50
char title[k_mdl_hit_title_max]
Display title, NUL-terminated.
Definition mdl_extract.h:51
char url[k_mdl_url_max]
Absolute series URL, NUL-terminated.
Definition mdl_extract.h:52
Bounded list of absolute URLs found on a page.
Definition mdl_extract.h:29
char urls[k_mdl_max_urls][k_mdl_url_max]
Absolute, NUL-terminated.
Definition mdl_extract.h:30
size_t count
Number of valid entries.
Definition mdl_extract.h:31