[HOWTO] Get Google's Search Results Without Extension!

The tutorial is perfect, however, the results that the text to speech reads to me are quite random, below I show images of my code, to see where I went wrong and what I can correct or fix.
Note:
I use a modified url with the url to do a Wikipedia search, due to how random google direct answers can be, this turned out to be more effective, however it doesn't change the fact how rare the answers get.
Thanks in advance.




The variables used in the tutorial are the same ones I use, so I didn't include them in the images.
Ignore the rest of the code in the larger block, because it's only the final part that matters, the one that includes the web viewer.

Do you mean, usually you will not get results for search?

Can you upload your AIA file for me to test? Also, did you create your own search engine through the dashboard and the API key?

2 Likes

I'm not sure what you are trying to achieve here.

The web API URL is working OK for you. I tested it, it returned a JSON, which is OK.

{
  "kind": "customsearch#search",
  "url": {
    "type": "application/json",
    "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
  },
  "queries": {
    "request": [
      {
        "title": "Google Custom Search - /es.wikipedia.org/wiki/",
        "totalResults": "144000",
        "searchTerms": "/es.wikipedia.org/wiki/",
        "count": 10,
        "startIndex": 1,
        "inputEncoding": "utf8",
        "outputEncoding": "utf8",
        "safe": "off",
        "cx": "a5db8a3c1f734468d"
      }
    ],
    "nextPage": [
      {
        "title": "Google Custom Search - /es.wikipedia.org/wiki/",
        "totalResults": "144000",
        "searchTerms": "/es.wikipedia.org/wiki/",
        "count": 10,
        "startIndex": 11,
        "inputEncoding": "utf8",
        "outputEncoding": "utf8",
        "safe": "off",
        "cx": "a5db8a3c1f734468d"
      }
    ]
  },
  "context": {
    "title": "Google Search Engine"
  },
  "searchInformation": {
    "searchTime": 0.535381,
    "formattedSearchTime": "0.54",
    "totalResults": "144000",
    "formattedTotalResults": "144,000"
  },
  "spelling": {
    "correctedQuery": "es.wikipedia.org/wiki/",
    "htmlCorrectedQuery": "\u003cb\u003e\u003ci\u003ees\u003c/i\u003e\u003c/b\u003e.wikipedia.org/wiki/"
  },
  "items": [
    {
      "kind": "customsearch#result",
      "title": "Glass – Glass",
      "htmlTitle": "Glass – Glass",
      "link": "https://www.google.com/glass/start/",
      "displayLink": "www.google.com",
      "snippet": "Glass Enterprise Edition is a hands-free device, for hands-on workers that removes distractions and helps you focus on what's most important.",
      "htmlSnippet": "Glass Enterprise Edition is a hands-free device, for hands-on workers that removes distractions and helps you focus on what's most important.",
      "cacheId": "c4vgB-irO1wJ",
      "formattedUrl": "https://www.google.com/glass/start/",
      "htmlFormattedUrl": "https://www.google.com/glass/start/",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQrpwEVpMgwYUg_5Imc-PwCp8nhsG1tDgRUhKYookjEqkasJFLj2g24MT2Y",
            "width": "232",
            "height": "217"
          }
        ],
        "metatags": [
          {
            "og:image": "https://lh3.googleusercontent.com/9ZsXJj_JW1KZ77fkIY7Ssh-ke-x6bxknnIHQDfd9AcRtqa9yppwaSvisaqmlr5shvL3oy6yPUxfQaOZsAbnUPA=s1600",
            "og:type": "website",
            "og:site_name": "Glass",
            "viewport": "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, height=device-height",
            "og:title": "Glass – Glass",
            "og:url": "https://www.google.com/glass/start/",
            "og:description": "Glass Enterprise Edition is a hands-free device, for hands-on workers that removes distractions and helps you focus on what's most important."
          }
        ],
        "cse_image": [
          {
            "src": "https://lh3.googleusercontent.com/FThTMM04RBljVz6bju7uKKqnXste7IDEWs01hZdidrIR6rTJRA0-Kp87BtaWERfzPituNe2AFw6U4HScVX8=w640-h600-c-pp"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "Google Earth",
      "htmlTitle": "Google Earth",
      "link": "https://www.google.com/earth/index.html",
      "displayLink": "www.google.com",
      "snippet": "Create stories and maps. With creation tools, you can draw on the map, add your photos and videos, customize your view, and share and collaborate with ...",
      "htmlSnippet": "Create stories and maps. With creation tools, you can draw on the map, add your photos and videos, customize your view, and share and collaborate with ...",
      "cacheId": "hG4K3PHoZqAJ",
      "formattedUrl": "https://www.google.com/earth/index.html",
      "htmlFormattedUrl": "https://www.google.com/earth/index.html",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcT2iTbFc46zcN_-4vw73SSiOqqud55-3a81RiHCSkbw7pyXozBNG-RUggxs",
            "width": "282",
            "height": "179"
          }
        ],
        "metatags": [
          {
            "og:image": "https://gweb-earth.storage.googleapis.com/assets/google_earth_banner.jpg",
            "og:type": "website",
            "og:site_name": "Google Earth",
            "viewport": "width=device-width, initial-scale=1.0, maximum-scale=2.0, height=device-height",
            "og:title": "Overview – Google Earth",
            "og:url": "https://www.google.com/earth/"
          }
        ],
        "cse_image": [
          {
            "src": "https://www.google.com/intl/en_us/earth/assets/static/images/studio_video_mobile_poster.png"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "Google Alerts - Monitor the Web for interesting new content",
      "htmlTitle": "Google Alerts - Monitor the Web for interesting new content",
      "link": "https://www.google.com/alerts",
      "displayLink": "www.google.com",
      "snippet": "Alerts ; Sources. Automatic. News. Blogs. Web. Video. Books. Discussions. Finance ; Language. Any Language. English. Afrikaans. Arabic. Armenian. Belarusian.",
      "htmlSnippet": "Alerts ; Sources. Automatic. News. Blogs. Web. Video. Books. Discussions. Finance ; Language. Any Language. English. Afrikaans. Arabic. Armenian. Belarusian.",
      "cacheId": "xf92VHvV6HgJ",
      "formattedUrl": "https://www.google.com/alerts",
      "htmlFormattedUrl": "https://www.google.com/alerts",
      "pagemap": {
        "metatags": [
          {
            "viewport": "width=device-width, user-scalable=no"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "DE102012016225A1 - Elektro-Feldenergie auf der Basis von ...",
      "htmlTitle": "DE102012016225A1 - Elektro-Feldenergie auf der Basis von ...",
      "link": "https://www.google.com/patents/DE102012016225A1?cl=es",
      "displayLink": "www.google.com",
      "snippet": "Exziton) ist ein gebundener Zustand von Elektron und Loch in einem Isolator bzw. einem Halbleiter. Es ist somit eine Element...de.wikipedia.org/wiki/Exziton.",
      "htmlSnippet": "Exziton) ist ein gebundener Zustand von Elektron und Loch in einem Isolator bzw. einem Halbleiter. \u003cb\u003eEs\u003c/b\u003e ist somit eine Element...de.\u003cb\u003ewikipedia\u003c/b\u003e.\u003cb\u003eorg\u003c/b\u003e/\u003cb\u003ewiki\u003c/b\u003e/Exziton.",
      "formattedUrl": "https://www.google.com/patents/DE102012016225A1?cl=es",
      "htmlFormattedUrl": "https://www.google.com/patents/DE102012016225A1?cl=\u003cb\u003ees\u003c/b\u003e",
      "pagemap": {
        "metatags": [
          {
            "referrer": "origin-when-crossorigin",
            "citation_patent_application_number": "DE:201210016225",
            "citation_patent_publication_number": "DE:102012016225:A1",
            "dc.type": "patent",
            "citation_reference": "\"Schwarze Löcher in Extra-Dimensionen\" zur Erlangung des Doktorgrades der Naturwissenschaften vorgelegt beim Fachbereich Physik der Johann Wolfgang Goethe - Universität in Frankfurt am Main von Sabine Hossenfelder aus Frankfurt am Main [Frankfurt am Main (2003) (DF1)]",
            "viewport": "width=device-width, initial-scale=1",
            "dc.relation": "DE:3529233:C2",
            "dc.title": "Elektro-Feldenergie auf der Basis von zweidimensionalen Elektronensystemen, mit der Energiemasse in dem koaxialen Leitungs- und Spulensystem des koaxialen Generators und Transformators",
            "citation_pdf_url": "https://patentimages.storage.googleapis.com/23/c8/6f/fcfcab474b888a/DE102012016225A1.pdf",
            "dc.date": "2012-08-14",
            "dc.contributor": "Anmelder Gleich"
          }
        ],
        "scholarlyarticle": [
          {
            "pdflink": "Download PDF",
            "countrycode": "DE",
            "numberwithoutcodes": "102012016225",
            "countryname": "Germany",
            "prioritydate": "2012-08-14",
            "title": "Elektro-Feldenergie auf der Basis von zweidimensionalen Elektronensystemen, mit der Energiemasse in dem koaxialen Leitungs- und Spulensystem des koaxialen Generators und Transformators",
            "type": "patent",
            "applicationnumber": "DE201210016225",
            "publicationdate": "2014-03-13",
            "publicationnumber": "DE102012016225A1",
            "priorartdate": "2012-08-14",
            "kindcode": "A1",
            "priorartkeywords": "energy",
            "filingdate": "2012-08-14",
            "publicationdescription": "Doc. laid open (first publication)",
            "inventor": "Anmelder Gleich",
            "pagetitle": "DE102012016225A1 - Elektro-Feldenergie auf der Basis von zweidimensionalen Elektronensystemen, mit der Energiemasse in dem koaxialen Leitungs- und Spulensystem des koaxialen Generators und...",
            "assigneeoriginal": "Jürgen Blum"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "Google Chrome Privacy Whitepaper",
      "htmlTitle": "Google Chrome Privacy Whitepaper",
      "link": "https://www.google.com/chrome/privacy/whitepaper.html",
      "displayLink": "www.google.com",
      "snippet": "Feb 4, 2021 ... This document also describes the controls available to you regarding how your data is used by Chrome. Here we're focusing on the desktop version ...",
      "htmlSnippet": "Feb 4, 2021 \u003cb\u003e...\u003c/b\u003e This document also describes the controls available to you regarding how your data is used by Chrome. Here we're focusing on the desktop version ...",
      "cacheId": "t67Y-xu-jmsJ",
      "formattedUrl": "https://www.google.com/chrome/privacy/whitepaper.html",
      "htmlFormattedUrl": "https://www.google.com/chrome/privacy/whitepaper.html",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQKOXFpJVF_Xz2cq8bSojiNKHJUoBzHsj8n3Sdsy1dQnCNO135b0qOVTw",
            "width": "48",
            "height": "48"
          }
        ],
        "metatags": [
          {
            "msapplication-config": "/chrome/static/images/favicons/browserconfig.xml",
            "og:image": "https://www.google.com/chrome/static/images/chrome-logo.svg",
            "twitter:card": "summary_large_image",
            "twitter:title": "Google Chrome Privacy Whitepaper",
            "og:type": "website",
            "twitter:url": "https://www.google.com/chrome/privacy/whitepaper.html",
            "og:title": "Google Chrome Privacy Whitepaper",
            "og:description": "Google Chrome Privacy Whitepaper",
            "twitter:image": "https://www.google.com/chrome/static/images/chrome-logo.svg",
            "viewport": "width=device-width, initial-scale=1",
            "twitter:description": "Google Chrome Privacy Whitepaper",
            "og:locale": "en_US",
            "og:url": "https://www.google.com/chrome/privacy/whitepaper.html"
          }
        ],
        "cse_image": [
          {
            "src": "https://www.google.com/chrome/static/images/chrome-logo.svg"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "Google Toolbar API - Guide to Making Custom Button",
      "htmlTitle": "Google Toolbar API - Guide to Making Custom Button",
      "link": "https://www.google.com/tools/toolbar/buttons/intl/en-GB/apis/howto_guide.html",
      "displayLink": "www.google.com",
      "snippet": "\u003csearch\u003ehttp://en.wikipedia.org/wiki/Special:Search?search= {query} &fulltext=Search\u003c/search\u003e. Adding this search element to the previous button, ...",
      "htmlSnippet": "<search>http://en.\u003cb\u003ewikipedia\u003c/b\u003e.\u003cb\u003eorg\u003c/b\u003e/\u003cb\u003ewiki\u003c/b\u003e/Special:Search?search= {query} &fulltext=Search</search>. Adding this search element to the previous button, ...",
      "cacheId": "nj0HsbIjwcsJ",
      "formattedUrl": "https://www.google.com/tools/toolbar/buttons/intl/en.../howto_guide.html",
      "htmlFormattedUrl": "https://www.google.com/tools/toolbar/buttons/intl/en.../howto_guide.html"
    },
    {
      "kind": "customsearch#result",
      "title": "Google",
      "htmlTitle": "Google",
      "link": "https://www.google.com/",
      "displayLink": "www.google.com",
      "snippet": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking ...",
      "htmlSnippet": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking ...",
      "cacheId": "y14FcUQOGl4J",
      "formattedUrl": "https://www.google.com/",
      "htmlFormattedUrl": "https://www.google.com/",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT3X9ZpkcNrr2kAcGZuXPZTNiK1oeTXhRMCZ1UGxNLf-an4du0eriX01mc",
            "width": "320",
            "height": "112"
          }
        ],
        "metatags": [
          {
            "referrer": "origin",
            "viewport": "width=device-width,minimum-scale=1.0",
            "google": "notranslate",
            "format-detection": "telephone=no"
          }
        ],
        "cse_image": [
          {
            "src": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "Google Accessibility",
      "htmlTitle": "Google Accessibility",
      "link": "https://www.google.com/accessibility/",
      "displayLink": "www.google.com",
      "snippet": "Guides and resources for using Google products in your organization. Initiatives and Research. Google's support of accessibility extends beyond ...",
      "htmlSnippet": "Guides and resources for using Google products in your \u003cb\u003eorganization\u003c/b\u003e. Initiatives and Research. Google's support of accessibility extends beyond ...",
      "cacheId": "OaJxsLTiACkJ",
      "formattedUrl": "https://www.google.com/accessibility/",
      "htmlFormattedUrl": "https://www.google.com/accessibility/",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQJM8WboS_hJU8Vq62FyX6nq6peFG9ye8nBF3avOB_zwJp_Bkd-gwM5SQ",
            "width": "116",
            "height": "41"
          }
        ],
        "metatags": [
          {
            "og:image": "https://www.google.com/images/logos/google_logo_41.png",
            "og:type": "website",
            "twitter:card": "summary",
            "og:site_name": "Google Accessibility",
            "twitter:site": "@googleaccess",
            "viewport": "initial-scale=1, minimum-scale=1, width=device-width",
            "og:title": "Accessibility",
            "og:url": "https://www.google.com/accessibility/",
            "og:description": "Accessibility content and links for Google websites."
          }
        ],
        "cse_image": [
          {
            "src": "https://www.google.com/images/logos/google_logo_41.png"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "¡Qué comiencen los Juegos de la Isla de Campeones de Doodle!",
      "htmlTitle": "¡Qué comiencen los Juegos de \u003cb\u003ela\u003c/b\u003e Isla de Campeones de Doodle!",
      "link": "https://www.google.com/doodles/doodle-champion-island-games-begin?hl=es-419",
      "displayLink": "www.google.com",
      "snippet": "Welcome to the Doodle Champion Island Games! Over the coming weeks, join calico (c)athlete Lucky as she explores Doodle Champion Island: a world filled with ...",
      "htmlSnippet": "Welcome to the Doodle Champion Island Games! Over the coming weeks, join calico (c)athlete Lucky as she explores Doodle Champion Island: a world filled with ...",
      "formattedUrl": "https://www.google.com/doodles/doodle-champion-island-games-begin?...es ...",
      "htmlFormattedUrl": "https://www.google.com/doodles/doodle-champion-island-games-begin?...\u003cb\u003ees\u003c/b\u003e ...",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRiDUJF5cgMgN57vcrJ_9OZHFNZn-rGArjcI5nT9jtVxlIpOfrCFwRhKfC3",
            "width": "296",
            "height": "170"
          }
        ],
        "metatags": [
          {
            "og:image": "http://www.google.com/logos/doodles/2021/doodle-champion-island-games-begin-6753651837108462.2-2xa.gif",
            "twitter:card": "summary_large_image",
            "twitter:title": "¡Qué comiencen los Juegos de la Isla de Campeones de Doodle!",
            "og:image:width": "652",
            "og:type": "website",
            "twitter:site": "@GoogleDoodles",
            "viewport": "width=device-width",
            "twitter:description": "¡A jugar! #GoogleDoodle",
            "og:title": "¡Qué comiencen los Juegos de la Isla de Campeones de Doodle!",
            "og:image:height": "376",
            "og:description": "¡A jugar! #GoogleDoodle",
            "twitter:image": "http://www.google.com/logos/doodles/2021/doodle-champion-island-games-begin-6753651837108462.2-2xa.gif"
          }
        ],
        "cse_image": [
          {
            "src": "http://www.google.com/logos/doodles/2021/doodle-champion-island-games-begin-6753651837108462.2-2xa.gif"
          }
        ]
      }
    },
    {
      "kind": "customsearch#result",
      "title": "Google",
      "htmlTitle": "Google",
      "link": "https://www.google.com/?hl=es",
      "displayLink": "www.google.com",
      "snippet": "Búsqueda · Imágenes · Maps · Play · YouTube · Noticias · Gmail · Drive · Más · Calendar · Traductor · Móviles · Libros · Shopping · Blogger · Finance ...",
      "htmlSnippet": "Búsqueda · Imágenes · Maps · Play · YouTube · Noticias · Gmail · Drive · Más · Calendar · Traductor · Móviles · Libros · Shopping · Blogger · Finance ...",
      "cacheId": "V6cW4k1LSwEJ",
      "formattedUrl": "https://www.google.com/?hl=es",
      "htmlFormattedUrl": "https://www.google.com/?hl=\u003cb\u003ees\u003c/b\u003e",
      "pagemap": {
        "cse_thumbnail": [
          {
            "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSvHPvXsdMhVw73am8Yzc6NaCYOQ3A9F5sksX4BxnyOW41q89NY73SULXw",
            "width": "272",
            "height": "92"
          }
        ],
        "webpage": [
          {
            "image": "/images/branding/googleg/1x/googleg_standard_color_128dp.png"
          }
        ],
        "cse_image": [
          {
            "src": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png"
          }
        ]
      }
    }
  ]
}
2 Likes

Usually results from Wikipedia are way fewer than Google. You want to show the 3rd result, which is oftenly nothing. I tested this AIA, it's working. I changed Spanish Wikipedia to English.

URL.aia (3.7 KB)

2 Likes

Thank you, I appreciate your answer, you are the only one who has been able to somehow solve my problem.
God bless you.

1 Like

Yes I did.