The extrinsic metadata are provided by the lister as the loading task parameters.
The intrinsic metadata lies within the DESCRIPTION file at the root tree of a tarball [1].
DESCRIPTION uses a simple file format called DCF, the Debian control format.
See [2] for the necessary parsing tools.
[1] https://r-pkgs.org/description.html
[2] python3-debian