Get Facebook Stories Image URL via Chrome Extension


A naive Chrome extension to help you get URL of images of Facebook Stories, so you don't have to right-click and open Chrome DevTools to check the URL.

You can load extension in developer mode. When the image of stories is playing, click the icon of this extension and the URL of the image will be logged in the console of Chrome DevTools.

manifest json:

manifest.json | repository | view raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
{
  "manifest_version": 2,

  "name": "FBStoryImg",
  "description" : "Get URL of Facebook Story Image",
  "version": "0.1",

  "browser_action": {
    "default_title": "Click to get story image URL"
  },

  "background": {
    "scripts": ["background.js"],
    "persistent": false
  },

  "permissions": [
    "activeTab"
  ]
}

background.js:

background.js | repository | view raw
1
2
3
4
5
chrome.browserAction.onClicked.addListener(function (tab) {
  chrome.tabs.executeScript(tab.id, {
    file: 'inject.js'
  });
});

inject.js:

inject.js | repository | view raw
1
2
3
4
5
6
var img = document.querySelector("img._5i4g._5sjv.img");
if (img != null) {
  console.log(img.src);
} else {
  console.log("cannot find image URL!");
}

References:

[1]