1.5v solar cell to replace two D batteries
Assuming you only need 25mA (big if), then yes it's likely that you can do this easily, the same way others have. You may need a solar panel with a larger current output to charge the battery, and the device may not like the lower voltage of a rechargeable battery chemistry.







simulate this circuit &ndash; Schematic created using CircuitLab

The first is a very basic. Dollar store (And more expensive) solar garden lights at this time use a led driver IC that also does turning on and off based on light and boost circuit for driving a 3V led, but essentially the same as this.

The second is a better idea. A stronger solar panel charging multiple batteries in series, and a voltage regulator to bring down the voltage to what your device needs.

Even if you need more current, the same still applies. You will just need a much better/larger solar panel. Maybe 12V 3W? The regulator option will be required at that point.