There are remanufactured MAFS available. The "S" is for sensor rather than system. There are two aftermarket remanufactured MAFS for 97 Altimas at this link.
https://www.rockauto.com/applet3.html
Try to repair the one you have as stanen8871 explains. Make sure you have the problem diagnosed correctly before you spend. Determine if you have an early or late 97 and order all parts accordingly. Have you accessed the code?
stanen8871
Before you pay 250 - 500 plus labor to replace your MAFS. Symptom is erratic rpm, bucking and stalling ( seems temperature sensitive ). When they fail you will get a check engine soon light with a ECM code of 0102 or 12. Start your engine, let it idle and tap on the MAFS if the idle fluctuates its bad. You can disassemble and fix this unit.
What usually happens is the solder connections inside the units pcb have a bad connection, disconnect from vehicle, on the top is a square plastic piece with silicone seal around it, scrape the sealer out, remove the plastic top and metal shield behind it. This will expose the solder connections on the pcb. Use a magnifying glass a look for breaks where the connector connections are mounted to the pcb. re-solder replace shield and plastic, reseal with silicone seal and you saved $$$. This why probably 70% of them fail. Just a helpful tip. Nissan and the rebuilders are making a fortune from people who just change them. That's why theres a core on this unit. I wanted to pass this on. Note this is happens to many models of Nissan cars and trucks. So before you just change it, check this out.