’Š¹.ŒŒ/€±?q=ÿ’žZì.w”€«”¡1è#1è
+1 byte as bug-fix if the input is about
.
+3 bytes, because it apparently doesn't work without the www.
Outputs the result in the same format as on the Google page itself (so with dots for thousand separators). If it should be returned as an integer, an additional trailing þ
can be added to the program.
Builtin .w
(read data from an URL) is disabled on TIO, so the TIO's are split into two parts:
Creating the Google search URL based on the input:
’Š¹.ŒŒ/€±?q=ÿ’žZì
Try it online.
Get the amount of results from the Google page:
”€«”¡1è#1è
Try it online.
The input is only a small portion of the entire google page, since the TIO-link would become over 30,000 characters long with the entire page.. :/ To test any google search page with this part of the program, follow these steps:
- Ctrl+U (Show page source)
- Copy-paste everything into the second TIO's input-field
- Surround it with leading and trailing
"""
(for multi-line string inputs)
Explanation:
’Š¹.ŒŒ/€±?q=ÿ’ # Push dictionary string "google.com/search?q=ÿ"
# where the `ÿ` is automatically filled with the (implicit) input
žZ # Push builtin string "http://www."
ì # Prepend it in front of the string
.w # Go to this URL, and get its page as string
”€«” # Push titlecased dictionary string "About"
¡ # Split the google page on that titlecased word
1è # Only leave the second part (0-based 1st)
# # Split that on spaces
1è # And index into the second part (0-based 1st) to get the amount
# (after which the result is output implicitly)
See this 05AB1E tips (section How to use the dictionary?) to understand why ’Š¹.ŒŒ/€±?q=ÿ’
is "google.com/search?q=ÿ"
and ”€«”
is "About"
.