loadXML() from SuggestQueries.Google.com via Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height: 300 | |
scrolling: yes | |
border: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script async src=https://cdn.JsDelivr.net/npm/p5></script> | |
<script defer src=sketch.js></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="hey google"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey dude shoes"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey dudes"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey arnold"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey there delilah"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey there delilah lyrics"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey ya lyrics"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey siri"/></CompleteSuggestion><CompleteSuggestion><suggestion data="hey ya"/></CompleteSuggestion></toplevel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* loadXML() from SuggestQueries.Google.com via Proxy (v1.0.0) | |
* Andreas_Ref & GoToLoop (2021-Sep-13) | |
* | |
* https://Discourse.Processing.org/t/issue-loading-xml-feed-in-p5js/8212/11 | |
* | |
* https://Bl.ocks.org/GoSubRoutine/33ba95eb188bbb6cd04e96e2d950b02b | |
* | |
* https://SuggestQueries.Google.com/complete/search?output=toolbar&hl=dk&q=hey | |
* | |
* https://Gist.GitHub.com/jimmywarting/ac1be6ea0297c16c477e17f8fbe51347 | |
*/ | |
"use strict"; | |
const | |
HTTP = 'https://', | |
PROX = 'CorsAnywhere.HerokuApp.com/', MODE = '', | |
SITE = 'SuggestQueries.Google.com/', FOLD = 'complete/', | |
QRY = 'search?output=toolbar&hl=dk&q=hey', | |
LINK = HTTP + PROX + MODE + HTTP + SITE + FOLD + QRY, | |
FILE = 'search.xml', REMOTE = false, | |
CHILDREN = 'CompleteSuggestion', CHILD = 'suggestion', ATTRIB = 'data', | |
LIST = 'ol', ITEM = 'li', | |
titles = []; | |
let xml; | |
function preload() { | |
console.info(LINK); | |
xml = loadXML(REMOTE && LINK || FILE, print, console.warn); | |
} | |
function setup() { | |
noCanvas(), noLoop(); | |
const children = xml.getChildren(CHILDREN); | |
for (const child of children) | |
titles.push(child.getChild(CHILD).getString(ATTRIB)); | |
const ol = createElement(LIST) | |
.style('color', 'blue') | |
.style('font-weight: bold') | |
.style('font-size: 1.2em'); | |
for (const title of titles) createElement(ITEM, title).parent(ol); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment