• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Auto-Downloder Chrome Extension

    September 18th, 2021
    comments, tech  [html]
    Let's say you want Chrome to automatically download pieces of pages, such as Facebook comments. How could you do it? I recently wanted to do this and couldn't find docs, so here's what I did.

    1. Make a folder somewhere for a browser extension.

    2. In that folder, make manifest.json with contents like:

        "name": "Downloader",
        "description": "Downloads stuff",
        "version": "1.0",
        "manifest_version": 3,
        "permissions": [
        "background": {
          "service_worker": "background.js"
        "content_scripts": [{
          "matches": [
          "js": ["content_script.js"]
    3. In content_script.js put:

      // This file extracts what you want from the page
      // and asks the background script to save it.
      // You write the code to extract what you want.
      const yourStringToSave =
          /* extension id not needed */ undefined,
    4. In background.js put:

      // This file receives messages from the content
      // script and puts them in your Dowloads folder.
      function makeDataUrl(body) {
        // We use a data: url because Chrome has
        // trouble with object URLs in Incognito.
        return "data:application/json;base64," +
        function(message) {
          const fname = message[0];
          const body = message[1];
            conflictAction: "overwrite",
            filename: fname,
            url: makeDataUrl(body),
    5. Visit chrome://extensions

    6. Enable Developer Mode

    7. Click the "Load unpacked" and select the extension directory

    8. If you need it in Incognito, click "Details" on the extension card and then enable "Allow in Incognito".

    Example code: github.

    (And, yes, this is how Facebook comments are back.)

    Comment via: facebook, lesswrong

    Recent posts on blogs I like:

    The Gift of It's Your Problem Now

    Recently a security hole in a certain open source Java library resulted in a worldwide emergency kerfuffle as, say, 40% of the possibly hundreds of millions of worldwide deployments of this library needed to be updated in a hurry. (The other 60% also …

    via apenwarr January 1, 2022

    The container throttling problem

    This is an excerpt from an internal document David Mackey and I co-authored in April 2019. The document is excerpted since much of the original doc was about comparing possible approaches to increasing efficency at Twitter, which is mostly information tha…

    via Posts on December 18, 2021

    Experiences in raising children in shared housing

    Sometimes I see posts about people’s hope to raise children in a group housing situation, and it often seems overly optimistic to me. In particular they seem to expect that there will be more shared childcare than I think should be expected. Today I talke…

    via The whole sky October 18, 2021

    more     (via openring)

  • Posts
  • RSS
  • ◂◂RSS
  • Contact