Export UVs correctly

hey guys,
I’m currently working on a realtime exporter for blender. Right now everything works fine and I can send vertices,normals and indices over tcp to another application. But now I have a problem with the texture coordinates. I want to explain it on an example:

I want to export a simple cube. Right now I export 8 vertices,8 normals and 8 indices. everything works fine. But to export the texture coordinates in a right way I need a cube with 24 vertices. 4 for each face.

Can anybody help me to realize it with bmesh? I think I have to seperate the mesh first by its faces and do then all the export stuff. but I want to do it with bmesh and temporary meshes inside the python code.

I hope you can help me. Thank you!