libwget-robots(3)
π libwget-robots β Robots Exclusion file parser π
okay bestie, welcome to the robots.txt corner of the wget2 library manual, a.k.a. libwget-robots(3). this is the little crew of functions that reads a Robots Exclusion Standard file and turns it into a data structure you can actually poke at. iconic behaviour honestly β¨
πΈ NAME πΈ
libwget-robots β Robots Exclusion file parser π¦
β¨ SYNOPSIS β¨
π Data Structures
struct wget_robots_st
π§ Macros
#define parse_record_field(d, f)
π Functions
int wget_robots_parse (wget_robots **_robots, const char *data, const char *client)
void wget_robots_free (wget_robots **robots)
int wget_robots_get_path_count (wget_robots *robots)
wget_string * wget_robots_get_path (wget_robots *robots, int index)
int wget_robots_get_sitemap_count (wget_robots *robots)
const char * wget_robots_get_sitemap (wget_robots *robots, int index)
π Detailed Description π
so like, the whole purpose of this little function family? it parses a Robots Exclusion Standard file into a data structure so you can access everything easily. that's it. that's the vibe. no cap. π
π Macro Definition Documentation π
#define parse_record_field( d, f)
Value:
parse_record_field(d, f, sizeof(f) - 1)
π Function Documentation π
int wget_robots_parse (wget_robots ** _robots, const char * data, const char * client)
Parameters
dataβ Memory with robots.txt content (with trailing 0-byte) πclientβ Name of the client / user-agent π«Ά
Returns
Return an allocated wget_robots structure or NULL on error π
The function parses the robots.txt data in accordance to https://www.robotstxt.org/orig.html#format and returns a ROBOTS structure including a list of the disallowed paths and including a list of the sitemap files.
β οΈ bestie listen: the ROBOTS structure has to be freed by calling wget_robots_free(). don't just leave it there, that's giving memory leak energy π
void wget_robots_free (wget_robots ** robots)
Parameters
robotsβ Pointer to Pointer towget_robotsstructure π
wget_robots_free() free's the formerly allocated wget_robots structure. it's the cleanup era, we love to see it π
int wget_robots_get_path_count (wget_robots * robots)
Parameters
robotsβ Pointer to instance ofwget_robotsπ¦
Returns
Returns the number of paths listed in robots β
wget_string * wget_robots_get_path (wget_robots * robots, int index)
Parameters
robotsβ Pointer to instance ofwget_robotsπΈindexβ Index of the wanted path π₯
Returns
Returns the path at index or NULL π
int wget_robots_get_sitemap_count (wget_robots * robots)
Parameters
robotsβ Pointer to instance ofwget_robotsπ§
Returns
Returns the number of sitemaps listed in robots β¨
const char * wget_robots_get_sitemap (wget_robots * robots, int index)
Parameters
robotsβ Pointer to instance ofwget_robotsπindexβ Index of the wanted sitemap URL π
Returns
Returns the sitemap URL at index or NULL π
π Author π
Generated automatically by Doxygen for wget2 from the source code. it literally wrote itself, main character energy fr fr π
and that's the whole page bestie!! this came from wget2, Version 2.3.0, living under the name libwget-robots(3) πβ¨ mwah, go parse some robots.txt, you got this π«Άπ
π¦ where this page comes from
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms