Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1013872 // Scrape freesound.org

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 206K of libraries. Click here for Pure Java version (5874L/39K/131K).

!7

sS query = "porsche";

// <a class="mp3_file" href="/data/previews/55/55727_267249-lq.mp3" title="mp3 file">porsche_911.wav - mp3 version</a>

p {
  S url = "https://freesound.org/search/?q=" + urlencode(query);
  S html = loadPage(url);
  LL<S> tags = findContainerTagWithParams(html, 'a, class := 'mp3_file);
  L<S> 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);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013872
Snippet name: Scrape freesound.org
Eternal ID of this version: #1013872/4
Text MD5: 472d85a2d0e397e4d60a46dbf4e91dad
Transpilation MD5: 1e89cba08dabc2c43183ddc9e383168f
Author: stefan
Category: javax / http
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-09 13:22:56
Source code size: 631 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 325 / 420
Version history: 3 change(s)
Referenced in: [show references]