Skip to content

Instantly share code, notes, and snippets.

@naoyeye
Created June 16, 2017 05:33
Show Gist options
  • Save naoyeye/a51ec7c58c4f077e437f78b2d3255b31 to your computer and use it in GitHub Desktop.
Save naoyeye/a51ec7c58c4f077e437f78b2d3255b31 to your computer and use it in GitHub Desktop.
扇贝中搜索特定的某个同桌申请者
var count = 1
var got = false
function searchYou() {
$.ajax({
'url': 'https://www.shanbay.com/api/v2/deskmate/userinfos/?page=' + count + '&ipp=10',
'success': function(resp) {
var list = resp.data.objects
if (!list.length) {
console.log('没了额')
return
}
for (var i = list.length - 1; i >= 0; i--) {
if (list[i].user_profile.user.nickname === 's▼' || list[i].user_profile.user.user_name === 'siiiiiiiiiii') {
console.log('找到了', list[i])
got = true
}
}
if (!got) {
count = count + 1;
console.log('没找到,继续')
setTimeout(function() {
searchYou()
}, 1000)
}
}
})
}
searchYou()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment