Search code examples
javayoutubehtml-parsingtrendinggoogle-trends

How to remove status 203 error in parsing Google-trends html response?


I am getting Google-trends data through html response after hitting on a URL. I managed to parse that response through Jsoup library. I got the data but only for 3-4 times. After that it started to giving Status-203 error.Each day i run this code for 3-4 times after that i got this exception. Please help me what should i do now ? My Code is -

public class HTMLParser {

private static HashMap<String, HashMap<String, String>> hostcokkies = new HashMap<String, HashMap<String,String>>();

public static ArrayList<HotTrends> getYouTubeTrendings()
{
    Document document;
    ArrayList<HotTrends> list = new ArrayList<HotTrends>();
    HotTrends trends          = null;
    try {
    document        =   Jsoup.connect("http://www.google.com/trends/fetchComponent?geo=IN&date=today+12-m&gprop=youtube&cmpt=q&cid=TOP_QUERIES_0_0").get();
    Elements links  =   document.select("a[href]");
      for(Element link : links){
          trends    =   new HotTrends();
          trends.setWord(link.text());
          list.add(trends);
      }
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    return list;
}

public static void main(String args[])
{
    ArrayList<HotTrends> hotTrends = new ArrayList<HotTrends>();
    hotTrends   =    HTMLParser.getYouTubeTrendings();
    for(HotTrends trends : hotTrends)
    {
        System.out.println(trends.getWord());
    }   
}

}


Solution

  • I have the same problem, just change your IP address by yourself or using a program (I use Hotspot Shield http://www.hotspotshield.com/) it works for me