-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py.patch
42 lines (38 loc) · 1.9 KB
/
bot.py.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- bot.py.a
+++ bot.py.b
@@ -66,29 +66,21 @@
self.config["streamers"].append([new_streamer, False])
def is_online(self, username):
- # Fixes issue #69 "Failed when calling is_online(..), new API url available."
- # See the link below for full list of API parameters (gender, region, tag, limit, offset, etc..)
- # Official Chaturbate API https://chaturbate.com/affiliates/promotools/api_usersonline/
- # Special thanks to https://www.blackhatworld.com/seo/chaturbate-api.1028000/page-2#post-11041420
-
- # With this API url, cam username must be in the first 500 results in order to be current_show="public" to be verified, due to max limit=500
- # offset=(any non-negative number) can be included to obtain more results beyond the first 500.
- MAX_API_RESULTS = "500"
- url = "https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=DkfRj&client_ip=request_ip&limit=" + MAX_API_RESULTS
+ url = "https://chaturbate.com/get_edge_hls_url_ajax/"
+ headers = {"X-Requested-With": "XMLHttpRequest"}
+ data = {"room_slug": username, "bandwidth": "high"}
try:
time.sleep(3) # fix issue 30
- r = requests.get(url)
- results = r.json()["results"]
-
- self.logger.debug(r)
- self.logger.debug(results)
-
- for result in results:
- if result["username"] == username and result["current_show"] in ["public"]:
- return True
+ r = requests.post(url, headers=headers, data=data)
+ if r.json()["room_status"] == "public":
+ return True
return False
+
+ except Exception as e:
+ self.logger.exception(e)
+ return None
except Exception as e:
self.logger.exception("Exception: call to is_online(..) failed.")