<commit_before>var targetPages = ["https://www.youtube.com/watch*"];

function closeTab(data) {
  if (!data.active) {
    browser.tabs.remove(data.id)
  }
}

function openInMpv(requestDetails) {
  if (requestDetails.type === "main_frame") {
    browser.runtime.sendNativeMessage("mpv", requestDetails.url + " --force-window=immediate ");

    querying = browser.tabs.get(requestDetails.tabId)
    querying.then(closeTab);

    return { cancel: true };
  }
}

browser.webRequest.onBeforeRequest.addListener(openInMpv, { urls: targetPages }, ["blocking"]);<commit_msg>Disable autoplay by default<commit_after>var targetPages = ["https://www.youtube.com/watch*"];

function closeTab(data) {
  if (!data.active) {
    browser.tabs.remove(data.id)
  }
}

function openInMpv(requestDetails) {
  if (requestDetails.type === "main_frame") {
    browser.runtime.sendNativeMessage("mpv", requestDetails.url + " --force-window=immediate --pause");

    querying = browser.tabs.get(requestDetails.tabId)
    querying.then(closeTab);

    return { cancel: true };
  }
}

browser.webRequest.onBeforeRequest.addListener(openInMpv, { urls: targetPages }, ["blocking"]);
{'fraction_non_alphanumeric': 0.15784908933217692, 'fraction_numerical': 0.0, 'mean_word_length': 4.6568627450980395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5349614', 'n_tokens_mistral': 380, 'n_tokens_neox': 373, 'n_words': 55}