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).

1  
!7
2  
3  
sS query = "porsche";
4  
5  
// <a class="mp3_file" href="/data/previews/55/55727_267249-lq.mp3" title="mp3 file">porsche_911.wav - mp3 version</a>
6  
7  
p {
8  
  S url = "https://freesound.org/search/?q=" + urlencode(query);
9  
  S html = loadPage(url);
10  
  LL<S> tags = findContainerTagWithParams(html, 'a, class := 'mp3_file);
11  
  L<S> tag = random(tags);
12  
  if (tag == null) { print("No result"); ret; }
13  
  S mp3 = "https://freesound.org" + getTagParam(second(tag), "href");
14  
  print(mp3);
15  
  File mp3File = programFile(urlencode(mp3));
16  
  if (fileLength(mp3File) == 0)
17  
    loadBinaryPageToFile(mp3, mp3File);
18  
  playMP3(mp3File);
19  
}

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: 439 / 574
Version history: 3 change(s)
Referenced in: [show references]