Never did a Ryobi, but I have rebuilt a few DeWalt and Milwaukee packs over the years.
Digikey carries a good line of NiCd and NiMH cells (including the high capacity ones for power tool applications), with solder tabs prewelded onto the ends. If you give them a sketch of how you want them assembled, they will even solder and shrinkwrap them into custom assemblies for you. http://www.digikey.com
Have you taken them apart already ? I have seen the odd Ryobi batterypack where the spotwelded tabs have come loose. Resoldering it will solve the problem.
Generally I prefer Makita but i fix the odd faulty battery pack for a friend of mine.
Most often they are sub C and are available from any good electronics hardware store.
Check prices per cell first, quite often if more than one cells are faulty it is better to replace the lot. It is not real good practise to fit one new cell in series with older cells which are already on the way out.
The product of rotation, excitation and flux produces electricty.
The Ryobi "ONE+" range is where you buy a bare tool and the battery/charger separately. At $35 a pair it's not going to be worth rebuilding, so long as the contact end is compatible with the older tools.