Skip to content

Fix fb_getAllUidFromFriendsPage.js #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VHAE04 opened this issue Jul 30, 2023 · 2 comments
Closed

Fix fb_getAllUidFromFriendsPage.js #9

VHAE04 opened this issue Jul 30, 2023 · 2 comments

Comments

@VHAE04
Copy link

VHAE04 commented Jul 30, 2023

rewrite code

export default {
  name: {
    en: "Get all fb User ID from Friends page",
    vi: "Lấy tất cả fb user id từ danh sách bạn bè",
  },
  description: {
    en: "Get id of all user from friends facebook page",
    vi: "Lấy tất cả user ID từ trang danh sách bạn bè facebook",
  },
  whiteList: ["https://www.facebook.com/*"],

  onClick: async function () {
    // Lấy tất cả uid từ trang facebook search bạn bè
    // Ví dụ: https://www.facebook.com/search/people/?q=*a&epa=FILTERS&filters=eyJmcmllbmRzIjoie1wibmFtZVwiOlwidXNlcnNfZnJpZW5kc19vZl9wZW9wbGVcIixcImFyZ3NcIjpcIjEwMDA2NDI2NzYzMjI0MlwifSJ9
    // Link trên được tạo từ web: https://sowsearch.info/

    //let list_a = Array.from(
    //  document.querySelectorAll("a[role='presentation']")
    //);
    // FIX lay ban be hay vao day roi sroll het ban be
    // https://www.facebook.com/friends/list

const linkElements = document.querySelectorAll('a.x1i10hfl.x1qjc9v5.xjbqb8w.xjqpnuy.xa49m3k.xqeqjp1.x2hbi6w.x13fuv20.xu3j5b3.x1q0q8m5.x26u7qi.x972fbf.xcfux6l.x1qhh985.xm0m39n.x9f619.x1ypdohk.xdl72j9.x2lah0s.xe8uvvx.xdj266r.x11i5rnm.xat24cr.x1mh8g0r.x2lwn1j.xeuugli.xexx8yu.x4uap5.x18d9i69.xkhd6sd.x1n2onr6.x16tdsg8.x1hl2dhg.xggy1nq.x1ja2u2z.x1t137rt.x1q0g3np.x87ps6o.x1lku1pv.x1a2a7pz.x1lq5wgf.xgqcy7u.x30kzoy.x9jhf4c.x1lliihq');
const linkHrefs = Array.from(linkElements).map(linkElement => linkElement.getAttribute('href'));
console.log(linkHrefs);

    let list_a=linkHrefs;
    if (!list_a.length) {
      return prompt(
        "Không tìm thấy thông tin, bạn đã ở đúng trang tìm kiếm bạn bè fb chưa?" +
          "\nTrang web ví dụ:",
        "https://www.facebook.com/search/people/?q=*a"
      );
    }

    alert("Đang lấy thông tin uid, mở console để xem tiến trình...");
    let uids = [];
    for (let a of list_a) {
      try {
        //let l = a.href;

        let uid = a.split("profile.php?id=")[1];
        if (uid) {
          uids.push(uid);
          console.log(uid);
          continue;
        }

        let name = l.split("facebook.com/")[1];
        uid = await UsefulScriptGlobalPageContext.Facebook.getUidFromUrl(l);
        uids.push(uid);
        console.log(name, uid);
      } catch (e) {
        console.log("Lỗi khi lấy thông tin của " + a, e);
      }
    }
    console.log(uids);
    prompt("Tất cả UID: ", uids.join("\n"));
  },
};

@HoangTran0410
Copy link
Member

please provide more information about this fix.
can you create merge request for this fix?

@HoangTran0410
Copy link
Member

Chức năng lấy thông tin danh sách bạn bè từ trang bạn bè đã có, còn chức năng này là lấy thông tin users từ trang tìm kiếm, 2 chức năng này khác nhau nhé.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants