Extract Page Assets API

scripts, stylesheets and feeds list the page's external scripts, stylesheets and RSS, Atom or JSON feeds. Set include_inline_assets=true to also include inline scripts and styles.

API Examples

Scripts


JSON Example

{
  ...
  "scripts": [
    {
      "position": 1,
      "source": "https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022",
      "async": true
    }
  ]
}

Stylesheets


JSON Example

{
  ...
  "stylesheets": [
    {
      "position": 1,
      "source": "https://en.wikipedia.org/w/load.php?lang=en&modules=ext.cite.styles%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediaBadges%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cmediawiki.page.gallery.styles%7Cmediawiki.skins.legacy%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"
    },
    {
      "position": 2,
      "source": "https://en.wikipedia.org/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"
    }
  ]
}

Feeds (RSS / Atom)


JSON Example

{
  ...
  "feeds": [
    {
      "position": 1,
      "title": "Wikipedia Atom feed",
      "source": "https://en.wikipedia.org/w/index.php?title=Special:RecentChanges&feed=atom",
      "type": "application/atom+xml"
    }
  ]
}

JSON Structure Overview

{
  ...
  "scripts": [
    {
      "position": "Integer - Position of the script",
      "source": "String - URL of the external script",
      "type": "String - Type attribute of the script",
      "async": "Boolean - Returns true if the script has the async attribute",
      "defer": "Boolean - Returns true if the script has the defer attribute",
      "content": "String - Code of an inline script, up to 5,000 characters. Only with include_inline_assets=true"
    },
    ...
  ],
  "stylesheets": [
    {
      "position": "Integer - Position of the stylesheet",
      "source": "String - URL of the external stylesheet",
      "media": "String - Media attribute of the stylesheet",
      "content": "String - CSS of an inline style, up to 5,000 characters. Only with include_inline_assets=true"
    },
    ...
  ],
  "feeds": [
    {
      "position": "Integer - Position of the feed",
      "title": "String - Title of the feed",
      "source": "String - URL of the feed",
      "type": "String - MIME type of the feed (e.g. 'application/rss+xml', 'application/atom+xml')"
    },
    ...
  ],
  ...
}