Home > Web Front-end > JS Tutorial > body text

9 lines of javascript code to obtain QQ group members specific implementation_javascript skills

WBOY
Release: 2016-05-16 17:19:56
Original
1910 people have browsed it

Yesterday I saw a Weibo post: "22 lines of JavaScript code to implement QQ group member extractor". I clicked in out of curiosity and found that the effect was not achieved. First, the QQ version was upgraded, and second, the code in the blog was also a bit cumbersome.

So I tried to write one, and it only had 9 lines including empty lines. Although the sparrow is small, it has all the internal organs.

Copy code The code is as follows:

var ids = document.querySelectorAll(".member_id") ;
var names = document.querySelectorAll(".member_name");
var output = "", length = ids.length;

for(var i=0; ioutput = ids[i].innerHTML.slice(1,-1) ":" names[i].innerHTML "n";
}
console.log(output);


Usage

Advanced like QQ group space, you can click this link to enter directly: http://qun.qzone.qq.com, if you want to get group information, first You must be a group member.

After logging in, there is [My Group] in the top menu. Select a group in the sub-menu. Then click [Group Members].

Press F12 to bring up the developer tools, and then select [javascript console]. (If using Chrome, you can just press Ctrl Shift J).

Paste the code below and press Enter!
Copy code The code is as follows:

var ids = document.querySelectorAll(".member_id") ;
var names = document.querySelectorAll(".member_name");
var output = "", length = ids.length;

for(var i=0; ioutput = ids[i].innerHTML.slice(1,-1) ":" names[i].innerHTML "n";
}
console.log(output);

If you find it too troublesome to copy over and over again, I made a bookmark.

Drag the following link to the bookmark bar: Get QQ group members

Then you can enter the group address book --> Ctrl Shift J --> Click the label bar -- > Copy.

Note: This code is for study and research only.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template