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

1  
static L<WithURL<S>> youTubeSearch_all(Browser browser, S query, double cacheExpirationDays default 1) {
2  
  // simplify query
3  
  query = simpleSpacesAndTrim(lower(query));
4  
  
5  
  FileBasedStringMap cache = new(javaxCachesDir("YouTube Searches"));
6  
  File f = cache.fileForKey(query);
7  
  if (exists(f) && fileAgeInDays(f) < cacheExpirationDays)
8  
    ret (L) unstructure(cache.get(query));
9  
  
10  
  // not in cache, start browser
11  
  
12  
  var result = youTubeSearch_uncached(browser, query);
13  
  cache.put(query, indentedStructure(result));
14  
  ret result;
15  
}

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: 171 / 262
Version history: 11 change(s)
Referenced in: [show references]