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 to wget_robots structure πŸŽ€

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 of wget_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 of wget_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 of wget_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 of wget_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