!7
sS query = "porsche";
// porsche_911.wav - mp3 version
p {
S url = "https://freesound.org/search/?q=" + urlencode(query);
S html = loadPage(url);
LL tags = findContainerTagWithParams(html, 'a, class := 'mp3_file);
L tag = random(tags);
if (tag == null) { print("No result"); ret; }
S mp3 = "https://freesound.org" + getTagParam(second(tag), "href");
print(mp3);
File mp3File = programFile(urlencode(mp3));
if (fileLength(mp3File) == 0)
loadBinaryPageToFile(mp3, mp3File);
playMP3(mp3File);
}