sorenlouv / fb-sleep-stats

Use Facebook to track your friends’ sleeping habits

Home Page:https://medium.com/@sqrendk/how-you-can-use-facebook-to-track-your-friends-sleeping-habits-505ace7fffb6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An error occurred in buddy list [Error: no users found]

Meflou opened this issue · comments

I don't know why it sometimes stop working for hours displaying this error:
screen shot 2016-03-23 at 13 20 31

And then it would start working normally again. I am getting this quite frequently, what does it mean? Is there any workaround to fix it?
I also have around 250 friends, not 92.

Short answer: I don't know why it's happening.

There are several ways to retrieve your list of friends. The optimal way fetches all of them, but (for some reason) it is not always available. Thus, we use a fallback, that gets far less. Not sure which friends it retrieves. I think it retrieves those you communicate with the most - but again, not sure.

If you are brave you can try to debug it from here:
https://github.com/sqren/fb-sleep/blob/master/index.js#L78

i just found that there is a number 5 in url: 'https://5-edge-chat.facebook.com/pull',
do that cause any difference when this number varies from 0 to 6?
i hope it help solve this problem.

@at01076172 The URL is the correct one. The issue is in the fb-sleep module.

I wonder if the c_user and xs cookies are getting through properly

I applied the patch

root@fb-sleep-stats:~/fb-sleep-stats# diff node_modules/fb-sleep/index.js.orig node_modules/fb-sleep/index.js
107a108
> console.log(parseFbResponse(res).ms[0]);
root@fb-sleep-stats:~/fb-sleep-stats# npm run scrape

> fb-sleep-stats@0.9.0 scrape /root/fb-sleep-stats
> node ./scrape.js

Polling every 60 seconds
{ type: 'deltaflowreject',
  queue: '100002898774648',
  reason: 'service' }
Error getting buddyList. Will fallback to other means of retrieving friends [Error: No users found]
6/2/2016, 1:30:37 PM  - Active users:  30 / 48
^C
root@fb-sleep-stats:~/fb-sleep-stats#

The issue is in the fb-sleep library. Facebook returns a 400 response when clientid is not provided.

Add these two lines added by sorenlouv/fb-sleep@03b89ca to node_modules/fb-sleep/index.js and it will be fixed.

@sqren the patch above seems to hit the right spot. I think you will want to publish a new build of the fb-sleep library on NPM with this change and have fb-sleep-stats use that instead of the current version that it is using.

Ideally you will want the client_id of messenger.com. Just inspect the network traffic, it seems to be a global constant. Seems to work with 0 but stops working after a while when it is 0, works indefinitely with the client_id of messenger.

> node ./scrape.js

Polling every 30 seconds
4/21/2018, 12:34:47 PM  - Active users:  20 / 435
4/21/2018, 12:35:16 PM  - Active users:  20 / 435
4/21/2018, 12:35:44 PM  - Active users:  20 / 435
4/21/2018, 12:36:11 PM  - Active users:  20 / 435
4/21/2018, 12:36:41 PM  - Active users:  20 / 435
4/21/2018, 12:37:10 PM  - Active users:  20 / 435