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

15
LINES

< > BotCompany Repo | #1032307 // youTubeSearch_all - get all results on first page. uses Playwright. caches query results

JavaX fragment (include) [tags: use-pretranspiled]

Uses 64664K of libraries. Click here for Pure Java version (9313L/56K).

static L<WithURL<S>> youTubeSearch_all(Browser browser, S query, double cacheExpirationDays default 1) {
  // simplify query
  query = simpleSpacesAndTrim(lower(query));
  
  FileBasedStringMap cache = new(javaxCachesDir("YouTube Searches"));
  File f = cache.fileForKey(query);
  if (exists(f) && fileAgeInDays(f) < cacheExpirationDays)
    ret (L) unstructure(cache.get(query));
  
  // not in cache, start browser
  
  var result = youTubeSearch_uncached(browser, query);
  cache.put(query, indentedStructure(result));
  ret result;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, uelavcdoioby

No comments. add comment

Snippet ID: #1032307
Snippet name: youTubeSearch_all - get all results on first page. uses Playwright. caches query results
Eternal ID of this version: #1032307/12
Text MD5: 36857c600d25d953e8b01b8faa742529
Transpilation MD5: c53e5244727e8b17b01271e0cd177826
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-30 04:31:22
Source code size: 551 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 170 / 261
Version history: 11 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1032313 - youTubeSearch_uncached - uses Playwright
#1032315 - youTubeSearch - get top search result. uses Playwright. caches query results
#1032450 - googleSearch_all - get all results on first page. uses Playwright. caches query results