导出Chrome浏览器扩展信息

发布于 2017-12-31 15:43:47

  1. 打开开发者工具
  2. 复制jquery源码到console版运行
  3. 运行下面这段代码,即可把扩展信息作为JSON文件下载
Array.prototype.last = function() {return this[this.length-1];}

function downloadObjectAsJson(exportObj, exportName){
  var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj));
  var downloadAnchorNode = document.createElement('a');
  downloadAnchorNode.setAttribute("href", dataStr);
  downloadAnchorNode.setAttribute("download", exportName + ".json");
  downloadAnchorNode.click();
  downloadAnchorNode.remove();
}

var info = [];
var extensions = $('.extension-details');

extensions.each((i, ext) => {
  ext = $(ext);
  var title = ext.find('.extension-title').text();
  var desc = ext.find('.extension-description').text();

  try{
    var url = ext.find('.site-link').attr("href").split('/').last();
  } catch(e) {
    return;
  }

  info.push({
    title: title,
    desc: desc,
    url: url,
  });
})

downloadObjectAsJson(info, 'MyChromeExtensions')

我的chrome扩展 at 2017.12.31:

https://gist.github.com/weaming/a054ef4e86f53c1e814444ac1cdf5732

comments powered by Disqus