I recommend the Python API. Recently we conducted an inventory of everything in our Portal. I was able to use the Python API to cycle through all of our Web Maps and output list of Layers with data sources.
Here are few lines to get you started. It isn't everything you need in the code but those are the main parts.
gis = GIS(url="PORTAL URL HERE", username="USERNAME", password="PASSWORD")
webmap_search = gis.content.search(query="", item_type="Web Map", max_items=10000)
for webmap_item in webmap_search:
print({webmap_item.title})
webmap = arcgis.mapping.WebMap(webmap_item)
for layer in webmap.layers:
print(f"- {layer.title if hasattr(layer, 'title') else 'Untitled Layer'}, {layer.url}")