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

18
LINES

< > BotCompany Repo | #1027428 // scrapeLotteryResults (old layout)

JavaX fragment (include)

sclass LotteryResult {
  S date;
  L<Int> numbers;
  S jackpot;
  
  [stdToString]
}

static LotteryResult scrapeLotteryResults(S html) {
  LS tok = htmlTok(html);
  new LotteryResult result;
  result.date = assertNempty("Date", rtagParam datetime(findTag time(tok)));
  LS tokResult = first(findContainerTagWithParams(tok, 'td, class := 'result));
  result.numbers = map parseInt(joinAll(contentsOfContainerTags(tokResult, 'li)));
  LS tokJackpot = first(findContainerTagWithParams(tok, 'span, class := "jackpot-amount"));
  result.jackpot = dropAllTags_trimJoin(tokJackpot);
  ret result;
}

Author comment

Began life as a copy of #1025908

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027428
Snippet name: scrapeLotteryResults (old layout)
Eternal ID of this version: #1027428/1
Text MD5: d3b37c1fa9249f5fb3c9f56e001b030e
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-19 20:32:25
Source code size: 609 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 86 / 117
Referenced in: [show references]