How to get the list url accessed while loading a page via javascript for use inside extension

how to access the list of urls accessed by a particular tab for use within extension?

for example when loading videos from sharepoint, how to get the URL for the videomanifest so that I can write to a local file for further use?

For example, you can use the browser.webRequest.onCompleted event to capture completed requests and the urls by tab.

export class TabRequestObserver {
  constructor() {
    this.requestUrlsByTab = new Map();
    browser.tabs.onRemoved.addListener((tabId) => this.requestUrlsByTab.delete(tabId));
    browser.webRequest.onCompleted.addListener((details) => {
      const { tabId, url } = details;
      const urls = this.requestUrlsByTab.get(tabId) ?? [];
      urls.push(url);
      this.requestUrlsByTab.set(tabId, urls);
    }, { urls: ["<all_urls>"] });
  }
  getUrlsByTabId(tabId) {
    return this.requestUrlsByTab.get(tabId) ?? [];
  }
}