Hmmm... i remember reading something about this, there is a calculation out there that works out the risk of being caught for various activities etc.
I think the chances of you catching and getting info out of a spy depend on the level of your hideout in relation to your walls and town hall, (i.e. have your hideout at least a level about your walls and town hall to make yourself a hard nut to crack) plus it depends on the person who's spying on you and their hideout level, their risk goes down if their hideout is of a higher level than your thus they can find out more!
Finally i do know that certain actions are riskier than others, i.e. look at someones messages has a really high risk (sometimes up to 90%) compared to say lookin in the warehouses. Also i know spies need to have a rest between missions or its more likely they'll be caught.
So in conclusion you are more likely to get info out of spies you caught if you have high walls and hideouts (with lots of spies working in the city for you) and if the other guy has a lower hideout than you and has exhausted his spy.
Hope this has helped
Kaz