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

!752

p {
  File bookmarksDir = userDir(".config/google-chrome/Default");
  assertTrue("No bookmarks dir", bookmarksDir.isDirectory());
  File bookmarksFile = new File(bookmarksDir, "Bookmarks");
  S text = loadTextFile(bookmarksFile);
  assertNotNull("No Bookmarks file: " + bookmarksFile.getAbsolutePath(), text);
  O json = jsonDecode(text);
  int n = 0;
  for (Map map : findAllMaps(json)) {
    O _url = map.get("url");
    if (_url instanceof S) {
      O name = map.get("name");
      O date = map.get("date_added");
      print("URL found: " + _url);
      if (name instanceof S)
        print("  Name: " + name);
      if (date instanceof S) pcall {
        print("  Date: " + formatDate(parseLong(date)));
      }
      ++n;
    }
  }
  print("URLs found: " + n);
}

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: 629 / 671
Referenced in: [show references]