Where is stored the list of libraries and the path

In order for your scripts to be able to extract data from KiCad’s libraries, you first need all schematic symbols to have valid footprints assigned.

Currently about 75% of schematic symbols have pre-assigned footprints:

If you have assigned the footprints, it’s pretty easy to get those footprints into a separate library. First put them on the PCB with: Eeschema / Tools / Update PCB from Schematic [F8], and then: Pcbnew / File / Archive Footrpints / …

This does put the footprints into (new or existing) library, but does not update the links to point to that library.

You may also want to have a look at:

There are (links to) some 60+ KiCad related projects and scripts.

A more generic search: kicad project archive at DuckDuckGo

also finds: GitHub - MitjaNemec/Kicad_action_plugins: Kicad action plugins and one of them is the “archive project” plugin which also handles with footprint information.

I’ve got a bit of a mushy mind with lots of holes. Can’t remember who forked which project from where. GIT is a bit chaotic in that aspect, but maybe one (or some) of these projects are useful for studying or modifying into your own scripts.