Learning guitarsolos by ear can be a lot of fun, can also be hard as you may not be able to play all the notes of the given solo. Some of the notes may be played too quickly for you to hear them properly, some parts of the solo may be beyond your technical abilities at the moment.
In cases like the above you can take the part of the solo you can hear, often these will be the melodic parts, the parts of the solo which may sound the best. You can take those parts and play them on their own. If the solo is fairly long and contains other melodic parts you like, it may be possible to mix those, various melodic parts, into one solo of your own. Keep playing the solo to get the feel. Playing along with orginal song where the solo comes from will help as well, to get the feel of the solo going. Over time you may be able to hear (and play) the rest of the solo, just keep at it.
Working out songs by ear will not only give you new songs and solos it is also practical eartraining, something which is essential for any serious musician and guitar player.