troubleshooting Question

Help save me money on Custom Search Engine dev time calls

Avatar of James Hancock
James HancockFlag for United States of America asked on
JavaWeb DevelopmentGoogle Chrome OS
5 Comments1 Solution506 ViewsLast Modified:
Hi
I am doing Google Custom Search in a Java program, and it is charging me $5 per 100 calls. This will add up during my dev window,
and I'd like to hardcode a response to help keep costs minimal.

This portion grabs the Results List... which are URL's
Result is part of the Google Custom Search API

public static void main(String[] args) throws GeneralSecurityException, IOException {
        List<Result> items = new ArrayList<Result>();
       
        for (long i = 1; i <= 1; i += 1) { // enter bigger numbers for bigger results
            items.addAll(executeSearch("Search Terms", i));
        }
       
       
        StringList latestResultsLinksList = new StringList(items.size());
        StringList TitlesList = new StringList(items.size());
        for(Result r : items) {
           latestResultsLinksList.add(r.getLink());
           TitlesList.add(r.getTitle());
           
           
        }

How might I hardcode the latestResultsLinksList to equal specific URL strings in code?
Could this be in a separate class, to minimize extra blocks of code?

StringList java class is attached

Example output is below, a simple search for 'Mickey Mouse'



About 25000000 results available
0:    Mickey Mouse - Wikipedia, the free encyclopedia, , http://en.wikipedia.org/wiki/Mickey_Mouse
1:    Mickey Mouse Barack Obama Shirt - Those Shirts, , http://www.thoseshirts.com/mic.html
2:    Rand Paul hits Obama for playing 'Mickey Mouse games' – CNN ..., , http://politicalticker.blogs.cnn.com/2013/03/11/rand-paul-hits-obama-for-playing-mickey-mouse-games/
3:    Mickey Mouse Clubhouse - Mickey's Fishy Story - YouTube, , http://www.youtube.com/watch?v=PC2jgDyJqBo
4:    Obama attorney: 'Mickey Mouse' could be on ballot - WND, , http://www.wnd.com/2012/04/obama-attorney-mickey-mouse-could-be-on-ballot/
5:    Mickey Mouse Clubhouse - Online Activites and Fun | Disney Junior, , http://disney.go.com/disneyjunior/mickey-mouse-clubhouse
6:    ACORN: Mickey Mouse for Obama? | The Economist, , http://www.economist.com/node/12432392
7:    Mickey Mouse follows Obama in backing gay marriage - The Guardian, , http://www.guardian.co.uk/world/2012/may/17/mickey-mouse-gay-marriage
8:    Chris Matthews: Obama “Big Bird” Ad is “Mickey Mouse”, , http://www.aim.org/don-irvine-blog/chris-matthews-obama-big-bird-ad-is-mickey-mouse/
9:    Mickey Mouse makes an appearance - The Washington Post, , http://www.washingtonpost.com/business/mickey-mouse-makes-an-appearance/2013/07/06/d9561d8e-df60-11e2-b2d4-ea6d8f477a01_story.html
StringList.java
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros