On each page, the page title has the username in it, as does the page itself. I need to make some sort of program (no idea what language it would use) to visit each link and grab the username from it, and accumulate all the usernames in the fashion user1,user2,user3 etc.
there are probably much more efficient ways to do this, but as long as you have the user IDs you can put them into the ids array here:
Code:
<body>
<div id="results"></div>
<script type="text/javascript">
function showUser(o){
document.getElementById("results").innerHTML+=o.query.results.body.div.center.div[0].div.div[3].ul.li[2].span.content.split(" ")[1]+"<br>";
}
var ids=[24880,25580,27380]
for (var i = 0; i < ids.length; i++) {
getUser(ids[i])
}
function getUser(num){
if (document.getElementById("giffgaff")){
document.body.removeChild(document.getElementById("giffgaff"));
}
var myurl=encodeURIComponent("http://community.giffgaff.com/t5/user/viewprofilepage/user-id/"+num)
scr=document.createElement("script");
scr.type="text/javascript";
scr.id="giffgaff"
scr.src='http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22'+myurl+'%2F%22&format=json&callback=showUser';
document.body.appendChild(scr);
}
</script>
</body>
there are probably much more efficient ways to do this, but as long as you have the user IDs you can put them into the ids array here:
Code:
<body>
<div id="results"></div>
<script type="text/javascript">
function showUser(o){
document.getElementById("results").innerHTML+=o.query.results.body.div.center.div[0].div.div[3].ul.li[2].span.content.split(" ")[1]+"<br>";
}
var ids=[24880,25580,27380]
for (var i = 0; i < ids.length; i++) {
getUser(ids[i])
}
function getUser(num){
if (document.getElementById("giffgaff")){
document.body.removeChild(document.getElementById("giffgaff"));
}
var myurl=encodeURIComponent("http://community.giffgaff.com/t5/user/viewprofilepage/user-id/"+num)
scr=document.createElement("script");
scr.type="text/javascript";
scr.id="giffgaff"
scr.src='http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22'+myurl+'%2F%22&format=json&callback=showUser';
document.body.appendChild(scr);
}
</script>
</body>
Xelawho, thank you so so so much! You, sir, are a gentleman and a scholar.
I used the Microsoft Word find and replace to get the user IDs by themselves then put them into your script, it worked wonders! Thank you very much my friend
I won't don't worry It's just to inform a load of people by PM in a scheme I run about a change but I didn't have their usernames, only their links and it would have taken hours and hours to do it manually.
ah, I get it. If you want to format the output differently, just change the innerHTML line - if you do it like this it will put a comma and a space after each username:
ah, I get it. If you want to format the output differently, just change the innerHTML line - if you do it like this it will put a comma and a space after each username: