First I get a full list of mods using:
Code: Select all
mods="$(curl https://mods.factorio.com/api/mods?page_size=max | jq --raw-output '.results[] | .name')"
Code: Select all
printf $mods | while read i; do curl https://mods.factorio.com/api/mods/"$i"/full | jq '.' > /home/jdf/mods/$i.json; done
Code: Select all
jq --slurp '.' /home/jdf/mods/*.json > /home/jdf/mods/concatenate.json
Code: Select all
jq --compact-output '.[] | {(.name): .license.name}' /home/jdf/mods/concatenate.json > /home/jdf/mods/concatenate-licenses.json
Code: Select all
{"VehicleGrids-Reduced":"GNU LGPLv3"}
{"vehiclehud":null}
{"vehicle_physics_again":null}
{"vehicle-physics":null}
{"vehicle_physics":null}
{"Vehicle_Radar":"MIT"}
{"vehicles-equipement-grid":"MIT"}
{"VehiclesEquipement":"MIT"}
{"VehicleSnap":"MIT"}
{"VehicleTrails":null}
{"Vehicle-turrets":"MIT"}
{"VehicleWagon2":null}
{"Vehicle Wagon":"MIT"}
{"Vehicle_Zoom":null}
{"verbosity":"MIT"}
{"VersepellesAlienFarm":"Attribution-NonCommercial 4.0 International"}
Why then is the API missing these licenses? Why is there no easy way to sort or filter mods by attributes like their license on the Mod Portal? Why do I have to send 8000+ requests just to get incomplete data? I don't know the answer to these questions, but it keeps me up at night.