Skip to content

Commit 2c56614

Browse files
authored
Update1 - Algumas melhorias from MarkusLuan/update1
2 parents 98c6b1d + 282cefd commit 2c56614

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"python.pythonPath": "c:\\Users\\marku\\Documents\\projetos\\inta_live\\env\\Scripts\\python.exe"
2+
"python.pythonPath": "env\\Scripts\\python"
33
}

instagram/constants.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,42 @@ class Constants:
99

1010
ANDROID_VERSION = 24
1111
ANDROID_RELEASE = '7.0'
12-
PHONE_MANUFACTURER = 'motorola'
13-
PHONE_DEVICE = 'Moto C Plus'
14-
PHONE_MODEL = 'panell_23_dl'
12+
PHONE_MANUFACTURER = 'MkgCriacoes'
13+
PHONE_DEVICE = 'MkLive'
14+
PHONE_MODEL = 'MkLive'
1515
PHONE_DPI = '240dpi'
1616
PHONE_RESOLUTION = '720x1280'
17-
PHONE_CHIPSET = 'mt6737'
17+
PHONE_CHIPSET = 'mk6737'
1818
VERSION_CODE = '138226743'
1919

20-
USER_AGENT_FORMAT = \
21-
"Mozilla/5.0 (Linux; Android {android_release}; {device}; wv) " \
20+
USER_AGENT = \
21+
"Mozilla/5.0 (Linux; Android %s; %s; wv) " \
2222
"AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 " \
23-
"Chrome/80.0.3987.99 Mobile Safari/537.36 " \
24-
"Instagram {app_version} Android ({android_version:d}/{android_release}; " \
25-
"{dpi}; {resolution}; {brand}; {device}; {model}; {chipset}; en_US; {version_code})"
23+
"Chrome/%s Mobile Safari/537.36 " \
24+
"Instagram %s Android (%s/%s; " \
25+
"%s; %s; %s; %s; %s; %s; en_US; %s)" % (
26+
ANDROID_RELEASE,
27+
PHONE_DEVICE,
28+
CHROME_VERSION,
29+
APP_VERSION,
30+
ANDROID_VERSION,
31+
ANDROID_RELEASE,
32+
PHONE_DPI,
33+
PHONE_RESOLUTION,
34+
PHONE_MANUFACTURER,
35+
PHONE_DEVICE,
36+
PHONE_MODEL,
37+
PHONE_CHIPSET,
38+
VERSION_CODE
39+
)
2640

27-
USER_AGENT = USER_AGENT_FORMAT.format(**{
28-
'app_version': APP_VERSION,
29-
'android_version': ANDROID_VERSION,
30-
'android_release': ANDROID_RELEASE,
31-
'brand': PHONE_MANUFACTURER,
32-
'device': PHONE_DEVICE,
33-
'model': PHONE_MODEL,
34-
'dpi': PHONE_DPI,
35-
'resolution': PHONE_RESOLUTION,
36-
'chipset': PHONE_CHIPSET,
37-
'version_code': VERSION_CODE})
41+
USER_AGENT_DESKTOP = \
42+
"Mozilla/5.0 (Windows NT %s; Win64; x64) " \
43+
"AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 " \
44+
"Chrome/%s Safari/537.36" % (
45+
WIN_VERSION,
46+
CHROME_VERSION
47+
)
3848

3949
DEVICE = uuid.uuid1()
4050
ANDROID_DEVICE = "android:%s" % DEVICE

instagram/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def fazerLogin(self, usuario, senha):
3131
res = req.json()
3232

3333
self.__cookies = self.__session.cookies.copy()
34-
self.__cookies.update({"usuario": usuario})
34+
self.__cookies.update({"usuario": req.cookies["ds_user"]})
3535
self.__cookies.update({"csrf_token": token})
3636

3737
if res["status"] != "ok" or res["logged_in_user"] is None:

static/js/stream.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ function getInfo(){
77
var viewCount = data.viewer_count;
88
var status = data.broadcast_status;
99

10-
div_asistindo.innerHTML = "AO VIVO<span>" + viewCount + "</span>";
11-
12-
if (status == "stoped"){
10+
if (status == "interrupted"){
11+
div_asistindo.innerHTML = "PAUSADO<span>.</span>";
12+
}else if (status == "stopped"){
1313
location.href = "stream/encerrar";
1414
return;
15+
}else{
16+
div_asistindo.innerHTML = "AO VIVO<span>" + viewCount + "</span>";
1517
}
1618

1719
setTimeout(getInfo, 2000);

0 commit comments

Comments
 (0)