Lately, it seems that some people are having trouble connecting pidgin to Yahoo Messenger services. The problem seems to be associated with the Yahoo server itself.
Solving the Yahoo Messenger problem
A temporary solution for this problem is to change the Pidgin YM server setting.
Go to Accounts->Select your YM screen name->Edit Account->Advance.
Then change the original value of “scs.msg.yahoo.com” to any of these ip address:
188.8.131.52, 184.108.40.206 , 220.127.116.11, 18.104.22.168, 22.214.171.124, 126.96.36.199, 188.8.131.52, 184.108.40.206
As shown on the screenshot :
Note that this is only a temporary solution and you should only use this as the last resort.