查看BM注册时间

Facebook11个月前更新 Hilve
3,893 0 1

在登陆有FB账户的浏览器打开BM,进入商务管理平台信息可直接查看到创建时间

查看BM注册时间

 

 

有的BM没有显示创建时间:

(function () {
  const jsonp = (url, opt = {}, fn = null) => {
    if (typeof opt === "function") {
      fn = opt;
      opt = {};
    }

    let {
      params: params = {},
      timeout = null,
      cbKey = "callback",
      cbVal = "__jsopcb" + Date.now(),
    } = opt;
    let timer = null;

    // if (cbVal === 'fengyu') {
    //   cbVal += Date.now()
    // }

    let s = "";
    for (let k in params) {
      s += `&${k}=${encodeURIComponent(params[k])}`;
    }
    s += `&${cbKey}=${cbVal}`;

    s = s.slice(1);

    url += (~url.indexOf("?") ? "&" : "?") + s;

    const script = document.createElement("script");

    const remove = () => {
      timer && clearTimeout(timer);
      document.head.removeChild(script);
      window[cbVal] = undefined;
    };

    script.src = url;

    if (typeof fn === "function") {
      window[cbVal] = (data) => {
        fn(data);
        remove();
      };

      document.head.appendChild(script);
      return;
    }

    return new Promise((resolve, reject) => {
      // 请求超时
      if (timeout) {
        timer = setTimeout(() => {
          reject(new Error("jsonp request timeout"));
          remove();
        }, timeout);
      }
      // 正常
      window[cbVal] = (data) => {
        resolve(data);
        remove();
      };

      document.head.appendChild(script);
    });
  };
  function getAccessToken() {
    const regex = /"EAAG(.*?)"/gm;
    const text = document.documentElement.innerHTML;
    const result = regex.exec(text);
    if (result[1]) {
      return `EAAG${result[1]}`;
    }
    return null;
  }

  function getBmId() {
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    return urlParams.get("business_id");
  }

  async function getInfo() {
    const bmId = getBmId();
    if (!bmId) {
      console.log("bmid not found");
      return;
    }
    const access_token = getAccessToken();
    if (!access_token) {
      console.log("access_token not found");
      return;
    }
    const url = `https://graph.facebook.com/v12.0/${bmId}?access_token=${access_token}&_index=0&_reqName=object:brand&_reqSrc=BrandResourceRequests.brands&date_format=U&fields=[%22name%22,%22created_time%22,%22created_by.fields(name)%22,%22updated_time%22,%22updated_by.fields(name)%22,%22extended_updated_time%22]&locale=en_US&method=get`;
    const result = await jsonp(url)
    const date = new Date(result.created_time * 1000)
    result.BM建立时间 = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
    console.log(JSON.stringify(result, null, 2));
  }
  getInfo();
})();

 

  • 进入商务管理平台信息界面 > 按F12 > 点击 console 控制 >复制上方代码粘贴
查看BM注册时间

 


 

  • 拉到最下方查看BM精准的创建时间
查看BM注册时间

 

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...