It doesn't affect footage items.
{
// Go backwards through all the items in the project
// Go backwards because we'll be deleting items from the list.
for (i = app.project.numItems; i >= 1; i--) {
var cur_item = app.project.item(i);
if (cur_item.typeName == "Footage" &&
cur_item.mainSource instanceof SolidSource) {
// The item is a solid.
var comps_using_item = cur_item.usedIn;
if (comps_using_item.length == 0) {
// The Solid is not used in any comps. Remove it.
cur_item.remove();
}
}
}
}
-------
Project before the script :

And after
