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

26
LINES

< > BotCompany Repo | #1003288 // List Chrome Bookmarks (tested on Linux, outdated, use getChromeBookmarks now)

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

Libraryless. Click here for Pure Java version (1299L/8K/28K).

1  
!752
2  
3  
p {
4  
  File bookmarksDir = userDir(".config/google-chrome/Default");
5  
  assertTrue("No bookmarks dir", bookmarksDir.isDirectory());
6  
  File bookmarksFile = new File(bookmarksDir, "Bookmarks");
7  
  S text = loadTextFile(bookmarksFile);
8  
  assertNotNull("No Bookmarks file: " + bookmarksFile.getAbsolutePath(), text);
9  
  O json = jsonDecode(text);
10  
  int n = 0;
11  
  for (Map map : findAllMaps(json)) {
12  
    O _url = map.get("url");
13  
    if (_url instanceof S) {
14  
      O name = map.get("name");
15  
      O date = map.get("date_added");
16  
      print("URL found: " + _url);
17  
      if (name instanceof S)
18  
        print("  Name: " + name);
19  
      if (date instanceof S) pcall {
20  
        print("  Date: " + formatDate(parseLong(date)));
21  
      }
22  
      ++n;
23  
    }
24  
  }
25  
  print("URLs found: " + n);
26  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003288
Snippet name: List Chrome Bookmarks (tested on Linux, outdated, use getChromeBookmarks now)
Eternal ID of this version: #1003288/1
Text MD5: fadb828f3ddc342f9872c320d09fb61e
Transpilation MD5: 6149c50ef5f41a6fff11ef9727239122
Author: stefan
Category: javax / native
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-06-17 18:39:29
Source code size: 800 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 699 / 766
Referenced in: [show references]