# Bookmarks Scanner

**URL:** <https://discourse.mozilla.org/t/bookmarks-scanner/9006>\
**Category:** Add-ons\
**Created:** [June 1, 2016, 3:00pm UTC](https://discourse.mozilla.org/t/bookmarks-scanner/9006 "2016-06-01T15:00:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimshoe52](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jimshoe52](https://discourse.mozilla.org/u/jimshoe52)\
**Post date:** [June 1, 2016, 3:00pm UTC](https://discourse.mozilla.org/t/bookmarks-scanner/9006/1 "2016-06-01T15:00:35Z")

</div>

Will there ever be a Bookmarks Scanner similar to AM-Deadlink? This tool is great but it doesn’t work with Firefox. An add-on that can scan for valid links & duplicates with the ability to keep or delete would be great!

---

<div class="post-metadata">

**Author:** ![noitidart](https://avatars.discourse-cdn.com/v4/letter/n/9f8e36/32.png) [@noitidart](https://discourse.mozilla.org/u/noitidart)\
**Post date:** [June 1, 2016, 3:14pm UTC](https://discourse.mozilla.org/t/bookmarks-scanner/9006/2 "2016-06-01T15:14:58Z")

</div>

It should be pretty easy to make an addon to do this.

The Webextension way, the recommended way is here:  
[https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/bookmarks](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/bookmarks)

This is how to do it with Addon SDK:

[https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level\_APIs/places\_bookmarks](https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/places_bookmarks)

This is how to do it with XPCOM:

```
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);

var query = hs.getNewQuery();
var options = hs.getNewQueryOptions();

// Query users bookmarks, not history
options.queryType = options.QUERY_TYPE_BOOKMARKS;
// Execute the search and store results
var result = hs.executeQuery(query, options);

// Open the root containerNode and open it
var resultContainerNode = result.root;
// OPEN resultContainerNode
resultContainerNode.containerOpen = true;
// Search results are now child items of this container?
for (var i = 0; i < resultContainerNode.childCount; ++i) {
    var childNode = resultContainerNode.getChild(i);
    if (childNode.type == childNode.RESULT_TYPE_URI) {
        console.log('childNode ' + i + ' is url = ', childNode)
        console.log('times visited = ', childNode.accessCount)
    }
    if (i >= 10) {
        break
    }
}

// CLOSE resultContainerNode
resultContainerNode.containerOpen = false;
```

---

<div class="post-metadata">

**Author:** ![jimshoe52](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jimshoe52](https://discourse.mozilla.org/u/jimshoe52)\
**Post date:** [June 2, 2016, 10:49am UTC](https://discourse.mozilla.org/t/bookmarks-scanner/9006/3 "2016-06-02T10:49:25Z")

</div>

Thanks for the reply, but I don’t have the skill or know how to do that. I was wondering if someone that does would be building something for an addon.
