/* built with Studio Sketchpad: * https://sketchpad.cc * * observe the evolution of this sketch: * https://p5js.sketchpad.cc/sp/pad/view/ro.PJj$R2zNrKv/rev.19 * * authors: * GoToLoop * license (unless otherwise specified): * creative commons attribution-share alike 3.0 license. * https://creativecommons.org/licenses/by-sa/3.0/ */ /** * loadXML from EkstraBladet (v1.3) * Andreas_Ref & GoToLoop (2017-May-19) * * Forum.Processing.org/two/discussion/22668/issue-loading-xml-feed-in-p5js#Item_11 * Gist.GitHub.com/jimmywarting/ac1be6ea0297c16c477e17f8fbe51347 * * p5js.ProcessingTogether.com/sp/pad/export/ro.CJr$SpnCkgIPQC * * EkstraBladet.dk/rssfeed/sport/ * EkstraBladet.dk/rss2/?mode=normal&submode=sport */ "use strict"; const HTTP = 'http:' + '//', //PROX = 'CORS-Anywhere.HerokuApp.com/', PROX = 'Dry-Sierra-94326.HerokuApp.com/', SITE = 'EkstraBladet.dk/', RSS1 = 'rssfeed/', RSS2 = 'rss2/', FILE = 'rss.xml', QRY0 = 'sport/', QRY1 = '?mode=' + 'normal', QRY2 = '&submode=' + 'sport', URI1 = HTTP + PROX + HTTP + SITE + RSS1 + QRY0, URI2 = HTTP + PROX + HTTP + SITE + RSS2 + QRY1 + QRY2, URI = URI1, //URI = URI2, REMOTE = true, titles = []; let xml; function preload() { console.info(URI); xml = loadXML(REMOTE && URI || FILE, print, console.warn); } function setup() { noCanvas(); for (const item of xml.getChild('channel').getChildren('item')) titles.push(item.getChild('title').getContent()); const ol = createElement('ol') .style('color', 'blue') .style('font-weight: bold') .style('font-size: 1.2em'); for (const title of titles) createElement('li', title).parent(ol); }