Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Commit 868e788

Browse files
authored
Merge pull request #19 from RaihanStark/master
add pre-define username/password
2 parents 4450fbe + 8e788bb commit 868e788

4 files changed

Lines changed: 40 additions & 18 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ fabric.properties
287287
# PyBuilder
288288

289289
# pyenv
290-
290+
env
291+
env/
291292
# pipenv
292293
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
293294
# However, in case of collaboration, if having platform-specific dependencies or dependencies

ItsAGramLive/ItsAGramLive.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,23 @@ class ItsAGramLive:
5656
IG_SIG_KEY = '4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178'
5757
SIG_KEY_VERSION = '4'
5858

59-
def __init__(self):
60-
parser = argparse.ArgumentParser(add_help=True)
61-
parser.add_argument("-u", "--username", type=str, help="username", required=True)
62-
parser.add_argument("-p", "--password", type=str, help="password", required=True)
63-
parser.add_argument("-proxy", type=str, help="Proxy format - user:password@ip:port", default=None)
64-
args = parser.parse_args()
59+
def __init__(self, username='', password=''):
60+
61+
if bool(username) == False and bool(password) == False:
62+
parser = argparse.ArgumentParser(add_help=True)
63+
parser.add_argument("-u", "--username", type=str, help="username", required=True)
64+
parser.add_argument("-p", "--password", type=str, help="password", required=True)
65+
parser.add_argument("-proxy", type=str, help="Proxy format - user:password@ip:port", default=None)
66+
args = parser.parse_args()
67+
68+
username = args.username
69+
password = args.password
6570

6671
m = hashlib.md5()
67-
m.update(args.username.encode('utf-8') + args.password.encode('utf-8'))
72+
m.update(username.encode('utf-8') + password.encode('utf-8'))
6873
self.device_id = self.generate_device_id(m.hexdigest())
6974

70-
self.set_user(username=args.username, password=args.password)
75+
self.set_user(username=username, password=password)
7176

7277
def set_user(self, username, password):
7378
self.username = username

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ It's A Gram Live is a Python script that create a Instagram Live and provide you
1111
```bash
1212
pip install ItsAGramLive
1313
```
14+
1415
## Usage
1516

1617
```python
1718
from ItsAGramLive import ItsAGramLive
1819

1920
live = ItsAGramLive()
2021

22+
# or if you want to pre-define the username and password without args
23+
# live = ItsAGramLive(
24+
# username='foo',
25+
# password='bar'
26+
# )
27+
2128
live.start()
2229
```
2330

@@ -28,30 +35,34 @@ python3 live_broadcast.py -u yourInstagramUsername -p yourPassword -proxy user:p
2835
The output will give you the RTMP Server address and the Stream key (automatically copied to your clipboard)
2936

3037
## Commands
38+
3139
- **info**
32-
Show details about the broadcast
40+
Show details about the broadcast
3341
- **mute comments**
34-
Prevent viewers from commenting
42+
Prevent viewers from commenting
3543
- **unmute comments**
36-
Allow viewers do comments
44+
Allow viewers do comments
3745
- **viewers**
38-
List viewers
46+
List viewers
3947
- **chat**
40-
Send a comment
48+
Send a comment
4149
- **comments**
42-
Get the list of comments
50+
Get the list of comments
4351
- **wave**
44-
Wave to a viewer
52+
Wave to a viewer
4553
- **stop**
46-
Terminate broadcast
54+
Terminate broadcast
4755

4856
## Contributing
57+
4958
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
5059

5160
Please make sure to update tests as appropriate.
5261

5362
## License
63+
5464
[ GNU GPLv3 ](https://choosealicense.com/licenses/gpl-3.0/)
5565

5666
## Buy me a coffee
67+
5768
<a href="https://www.buymeacoffee.com/harrypython" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 37px !important;" ></a>

live_broadcast.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from ItsAGramLive import ItsAGramLive
22

3-
live = ItsAGramLive()
3+
# live = ItsAGramLive()
4+
5+
live = ItsAGramLive(
6+
username='foo',
7+
password='bar'
8+
)
49

510
live.start()

0 commit comments

Comments
 (0)