Exporting to as GLTF changes names

I am trying to export the centerline from a scene with a python script.

OBJ/STL etc. don’t export the centerline at all.

So I have to use GLTF - which works fine so far.
The problem here is that it exports the whole scene - including camera, bounding box, arrows, mesh etc.

And then it’s naming everything mesh0, mesh1, mesh2 …

I need a way to isolate the centerline curve somehow.

How can I do this?
Is there a way to only export the curve with the gltfexporter?
Or otherwise have the names etc. so that I can isolate it that way later?