parth-dl 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- parth_dl-1.0.0/LICENSE +31 -0
- parth_dl-1.0.0/MANIFEST.in +13 -0
- parth_dl-1.0.0/PKG-INFO +211 -0
- parth_dl-1.0.0/README.md +174 -0
- parth_dl-1.0.0/parth_dl/__init__.py +53 -0
- parth_dl-1.0.0/parth_dl/cli.py +169 -0
- parth_dl-1.0.0/parth_dl/core.py +274 -0
- parth_dl-1.0.0/parth_dl/extractors.py +526 -0
- parth_dl-1.0.0/parth_dl/utils.py +285 -0
- parth_dl-1.0.0/parth_dl.egg-info/PKG-INFO +211 -0
- parth_dl-1.0.0/parth_dl.egg-info/SOURCES.txt +15 -0
- parth_dl-1.0.0/parth_dl.egg-info/dependency_links.txt +1 -0
- parth_dl-1.0.0/parth_dl.egg-info/entry_points.txt +2 -0
- parth_dl-1.0.0/parth_dl.egg-info/top_level.txt +1 -0
- parth_dl-1.0.0/requirements.txt +10 -0
- parth_dl-1.0.0/setup.cfg +4 -0
- parth_dl-1.0.0/setup.py +58 -0
parth_dl-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Saksham Pathak (Parthmax)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
ADDITIONAL DISCLAIMER:
|
|
26
|
+
|
|
27
|
+
This software may interact with third-party services (Instagram) in ways that
|
|
28
|
+
could violate their Terms of Service. Users are solely responsible for ensuring
|
|
29
|
+
their usage complies with all applicable terms, laws, and regulations.
|
|
30
|
+
|
|
31
|
+
The author(s) disclaim all liability for any misuse of this software.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Include documentation
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
|
|
5
|
+
# Include requirements (even though empty)
|
|
6
|
+
include requirements.txt
|
|
7
|
+
|
|
8
|
+
# Exclude unnecessary files
|
|
9
|
+
global-exclude __pycache__
|
|
10
|
+
global-exclude *.py[co]
|
|
11
|
+
global-exclude .DS_Store
|
|
12
|
+
global-exclude *.swp
|
|
13
|
+
global-exclude *~
|
parth_dl-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: parth-dl
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Instagram media downloader for public content (reels, posts, profile pictures)
|
|
5
|
+
Home-page: https://github.com/parthmax2/parth-dl
|
|
6
|
+
Author: Parth
|
|
7
|
+
Author-email: your.email@example.com
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/parthmax2/parth-dl/issues
|
|
9
|
+
Project-URL: Source, https://github.com/parthmax2/parth-dl
|
|
10
|
+
Keywords: instagram downloader reel video image profile-picture media
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Topic :: Multimedia :: Video
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: keywords
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
Dynamic: project-url
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
Dynamic: summary
|
|
37
|
+
|
|
38
|
+
# parth-dl
|
|
39
|
+
|
|
40
|
+
**Instagram Media Downloader for Developers** — Download reels, posts, and profile pictures. Public content only. Zero dependencies.
|
|
41
|
+
|
|
42
|
+
[](https://www.python.org/downloads/)
|
|
43
|
+
[](LICENSE)
|
|
44
|
+
[]()
|
|
45
|
+
|
|
46
|
+
> Built by [@parthmax_](https://instagram.com/parthmax_) • Zero bloat, pure Python stdlib
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🔥 Why parth-dl?
|
|
51
|
+
|
|
52
|
+
Most Instagram downloaders are **bloated**, **outdated**, or **require authentication**. This one doesn't.
|
|
53
|
+
|
|
54
|
+
- ✅ **Reels with audio** — Guaranteed combined streams
|
|
55
|
+
- ✅ **Posts (images/videos)** — Carousel support included
|
|
56
|
+
- ✅ **Profile pictures** — High-resolution extraction
|
|
57
|
+
- ✅ **Zero dependencies** — Pure Python stdlib (no pip hell)
|
|
58
|
+
- ✅ **Rate limiting** — Built-in protection against IP bans
|
|
59
|
+
- ✅ **Retry logic** — Exponential backoff on failures
|
|
60
|
+
- ✅ **Public only** — No login required
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## ⚡ Installation
|
|
65
|
+
|
|
66
|
+
### From Source
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/parthmax2/parth-dl.git
|
|
69
|
+
cd parth-dl
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### From PyPI (soon)
|
|
74
|
+
```bash
|
|
75
|
+
pip install parth-dl
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 🚀 Usage
|
|
81
|
+
|
|
82
|
+
### CLI
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Download a reel
|
|
86
|
+
parth-dl https://www.instagram.com/reel/ABC123/
|
|
87
|
+
|
|
88
|
+
# Download a post
|
|
89
|
+
parth-dl https://www.instagram.com/p/ABC123/
|
|
90
|
+
|
|
91
|
+
# Download profile picture
|
|
92
|
+
parth-dl https://www.instagram.com/username/
|
|
93
|
+
|
|
94
|
+
# Custom output
|
|
95
|
+
parth-dl https://www.instagram.com/reel/ABC123/ -o my_video.mp4
|
|
96
|
+
|
|
97
|
+
# List formats
|
|
98
|
+
parth-dl https://www.instagram.com/reel/ABC123/ --list-formats
|
|
99
|
+
|
|
100
|
+
# Verbose mode
|
|
101
|
+
parth-dl https://www.instagram.com/reel/ABC123/ -v
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Python API
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from parth_dl import InstagramDownloader
|
|
108
|
+
|
|
109
|
+
# Initialize
|
|
110
|
+
dl = InstagramDownloader(verbose=True)
|
|
111
|
+
|
|
112
|
+
# Download
|
|
113
|
+
dl.download('https://www.instagram.com/reel/ABC123/')
|
|
114
|
+
|
|
115
|
+
# Get metadata
|
|
116
|
+
info = dl.get_info('https://www.instagram.com/reel/ABC123/')
|
|
117
|
+
print(info)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Quick function:**
|
|
121
|
+
```python
|
|
122
|
+
from parth_dl import download
|
|
123
|
+
download('https://www.instagram.com/reel/ABC123/')
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🛠️ Architecture
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
parth-dl/
|
|
132
|
+
├── parth_dl/
|
|
133
|
+
│ ├── __init__.py # Package entry + exports
|
|
134
|
+
│ ├── core.py # Main orchestrator
|
|
135
|
+
│ ├── extractors.py # API/GraphQL/Embed/Page extractors
|
|
136
|
+
│ ├── utils.py # Security, retry, rate-limit
|
|
137
|
+
│ └── cli.py # CLI interface
|
|
138
|
+
├── setup.py
|
|
139
|
+
├── README.md
|
|
140
|
+
└── requirements.txt # (Empty — zero deps!)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Key Features:**
|
|
144
|
+
- **4 extraction methods** with intelligent fallback
|
|
145
|
+
- **Token bucket rate limiter** (30 req/60s)
|
|
146
|
+
- **Exponential backoff** with jitter
|
|
147
|
+
- **URL validation** to prevent injection
|
|
148
|
+
- **Filename sanitization** for safe I/O
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔒 Security
|
|
153
|
+
|
|
154
|
+
- **No external dependencies** → No supply chain attacks
|
|
155
|
+
- **URL validation** → Prevents injection
|
|
156
|
+
- **Rate limiting** → Avoids IP bans
|
|
157
|
+
- **Retry logic** → Handles transient failures
|
|
158
|
+
- **Timeout controls** → No hanging requests
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## ⚠️ Disclaimer
|
|
163
|
+
|
|
164
|
+
**For educational and personal use only.**
|
|
165
|
+
|
|
166
|
+
This tool may violate Instagram's Terms of Service. By using it, you accept full responsibility for:
|
|
167
|
+
- Compliance with Instagram ToS
|
|
168
|
+
- Copyright and intellectual property laws
|
|
169
|
+
- Ethical usage
|
|
170
|
+
|
|
171
|
+
Only download content you have permission to use. Respect creators' rights.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 🤝 Contributing
|
|
176
|
+
|
|
177
|
+
PRs welcome! Follow these steps:
|
|
178
|
+
|
|
179
|
+
1. Fork the repo
|
|
180
|
+
2. Create a feature branch (`git checkout -b feature/xyz`)
|
|
181
|
+
3. Commit changes (`git commit -m 'Add xyz'`)
|
|
182
|
+
4. Push to branch (`git push origin feature/xyz`)
|
|
183
|
+
5. Open a PR
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 📝 License
|
|
188
|
+
|
|
189
|
+
MIT License — See [LICENSE](LICENSE) for details.
|
|
190
|
+
|
|
191
|
+
**Provided "as is" without warranty.** Instagram may change APIs anytime. Not responsible for misuse.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 📬 Connect
|
|
196
|
+
|
|
197
|
+
- **Author:** Saksham Pathak (Parthmax)
|
|
198
|
+
- **Instagram:** [@parthmax_](https://instagram.com/parthmax_)
|
|
199
|
+
- **LinkedIn:** [Saksham Pathak](https://linkedin.com/in/sakshampathak)
|
|
200
|
+
- **Hugging Face:** [parthmax](https://huggingface.co/parthmax)
|
|
201
|
+
- **Email:** pathaksaksham430@gmail.com
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
<div align="center">
|
|
206
|
+
|
|
207
|
+
**Built with ❤️ by Parthmax**
|
|
208
|
+
|
|
209
|
+
[⭐ Star this repo](https://github.com/parthmax2/parth-dl) if you found it useful!
|
|
210
|
+
|
|
211
|
+
</div>
|
parth_dl-1.0.0/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# parth-dl
|
|
2
|
+
|
|
3
|
+
**Instagram Media Downloader for Developers** — Download reels, posts, and profile pictures. Public content only. Zero dependencies.
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[]()
|
|
8
|
+
|
|
9
|
+
> Built by [@parthmax_](https://instagram.com/parthmax_) • Zero bloat, pure Python stdlib
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🔥 Why parth-dl?
|
|
14
|
+
|
|
15
|
+
Most Instagram downloaders are **bloated**, **outdated**, or **require authentication**. This one doesn't.
|
|
16
|
+
|
|
17
|
+
- ✅ **Reels with audio** — Guaranteed combined streams
|
|
18
|
+
- ✅ **Posts (images/videos)** — Carousel support included
|
|
19
|
+
- ✅ **Profile pictures** — High-resolution extraction
|
|
20
|
+
- ✅ **Zero dependencies** — Pure Python stdlib (no pip hell)
|
|
21
|
+
- ✅ **Rate limiting** — Built-in protection against IP bans
|
|
22
|
+
- ✅ **Retry logic** — Exponential backoff on failures
|
|
23
|
+
- ✅ **Public only** — No login required
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ⚡ Installation
|
|
28
|
+
|
|
29
|
+
### From Source
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/parthmax2/parth-dl.git
|
|
32
|
+
cd parth-dl
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### From PyPI (soon)
|
|
37
|
+
```bash
|
|
38
|
+
pip install parth-dl
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🚀 Usage
|
|
44
|
+
|
|
45
|
+
### CLI
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Download a reel
|
|
49
|
+
parth-dl https://www.instagram.com/reel/ABC123/
|
|
50
|
+
|
|
51
|
+
# Download a post
|
|
52
|
+
parth-dl https://www.instagram.com/p/ABC123/
|
|
53
|
+
|
|
54
|
+
# Download profile picture
|
|
55
|
+
parth-dl https://www.instagram.com/username/
|
|
56
|
+
|
|
57
|
+
# Custom output
|
|
58
|
+
parth-dl https://www.instagram.com/reel/ABC123/ -o my_video.mp4
|
|
59
|
+
|
|
60
|
+
# List formats
|
|
61
|
+
parth-dl https://www.instagram.com/reel/ABC123/ --list-formats
|
|
62
|
+
|
|
63
|
+
# Verbose mode
|
|
64
|
+
parth-dl https://www.instagram.com/reel/ABC123/ -v
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Python API
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from parth_dl import InstagramDownloader
|
|
71
|
+
|
|
72
|
+
# Initialize
|
|
73
|
+
dl = InstagramDownloader(verbose=True)
|
|
74
|
+
|
|
75
|
+
# Download
|
|
76
|
+
dl.download('https://www.instagram.com/reel/ABC123/')
|
|
77
|
+
|
|
78
|
+
# Get metadata
|
|
79
|
+
info = dl.get_info('https://www.instagram.com/reel/ABC123/')
|
|
80
|
+
print(info)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Quick function:**
|
|
84
|
+
```python
|
|
85
|
+
from parth_dl import download
|
|
86
|
+
download('https://www.instagram.com/reel/ABC123/')
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 🛠️ Architecture
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
parth-dl/
|
|
95
|
+
├── parth_dl/
|
|
96
|
+
│ ├── __init__.py # Package entry + exports
|
|
97
|
+
│ ├── core.py # Main orchestrator
|
|
98
|
+
│ ├── extractors.py # API/GraphQL/Embed/Page extractors
|
|
99
|
+
│ ├── utils.py # Security, retry, rate-limit
|
|
100
|
+
│ └── cli.py # CLI interface
|
|
101
|
+
├── setup.py
|
|
102
|
+
├── README.md
|
|
103
|
+
└── requirements.txt # (Empty — zero deps!)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Key Features:**
|
|
107
|
+
- **4 extraction methods** with intelligent fallback
|
|
108
|
+
- **Token bucket rate limiter** (30 req/60s)
|
|
109
|
+
- **Exponential backoff** with jitter
|
|
110
|
+
- **URL validation** to prevent injection
|
|
111
|
+
- **Filename sanitization** for safe I/O
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 🔒 Security
|
|
116
|
+
|
|
117
|
+
- **No external dependencies** → No supply chain attacks
|
|
118
|
+
- **URL validation** → Prevents injection
|
|
119
|
+
- **Rate limiting** → Avoids IP bans
|
|
120
|
+
- **Retry logic** → Handles transient failures
|
|
121
|
+
- **Timeout controls** → No hanging requests
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## ⚠️ Disclaimer
|
|
126
|
+
|
|
127
|
+
**For educational and personal use only.**
|
|
128
|
+
|
|
129
|
+
This tool may violate Instagram's Terms of Service. By using it, you accept full responsibility for:
|
|
130
|
+
- Compliance with Instagram ToS
|
|
131
|
+
- Copyright and intellectual property laws
|
|
132
|
+
- Ethical usage
|
|
133
|
+
|
|
134
|
+
Only download content you have permission to use. Respect creators' rights.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 🤝 Contributing
|
|
139
|
+
|
|
140
|
+
PRs welcome! Follow these steps:
|
|
141
|
+
|
|
142
|
+
1. Fork the repo
|
|
143
|
+
2. Create a feature branch (`git checkout -b feature/xyz`)
|
|
144
|
+
3. Commit changes (`git commit -m 'Add xyz'`)
|
|
145
|
+
4. Push to branch (`git push origin feature/xyz`)
|
|
146
|
+
5. Open a PR
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 📝 License
|
|
151
|
+
|
|
152
|
+
MIT License — See [LICENSE](LICENSE) for details.
|
|
153
|
+
|
|
154
|
+
**Provided "as is" without warranty.** Instagram may change APIs anytime. Not responsible for misuse.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 📬 Connect
|
|
159
|
+
|
|
160
|
+
- **Author:** Saksham Pathak (Parthmax)
|
|
161
|
+
- **Instagram:** [@parthmax_](https://instagram.com/parthmax_)
|
|
162
|
+
- **LinkedIn:** [Saksham Pathak](https://linkedin.com/in/sakshampathak)
|
|
163
|
+
- **Hugging Face:** [parthmax](https://huggingface.co/parthmax)
|
|
164
|
+
- **Email:** pathaksaksham430@gmail.com
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
<div align="center">
|
|
169
|
+
|
|
170
|
+
**Built with ❤️ by Parthmax**
|
|
171
|
+
|
|
172
|
+
[⭐ Star this repo](https://github.com/parthmax2/parth-dl) if you found it useful!
|
|
173
|
+
|
|
174
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
parth-dl: Instagram Media Downloader
|
|
3
|
+
Download Instagram reels, posts, and profile pictures (public accounts only)
|
|
4
|
+
|
|
5
|
+
Author: Parth
|
|
6
|
+
License: MIT
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "1.0.0"
|
|
10
|
+
__author__ = "Parth"
|
|
11
|
+
__description__ = "Instagram media downloader for public content"
|
|
12
|
+
|
|
13
|
+
from .core import InstagramDownloader
|
|
14
|
+
from .utils import DownloadError, RateLimitError, NetworkError
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
'InstagramDownloader',
|
|
18
|
+
'DownloadError',
|
|
19
|
+
'RateLimitError',
|
|
20
|
+
'NetworkError',
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def download(url, output_path=None, quality='best', verbose=False):
|
|
25
|
+
"""
|
|
26
|
+
Quick download function
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
url: Instagram URL (reel, post, or profile)
|
|
30
|
+
output_path: Output file/directory path
|
|
31
|
+
quality: 'best' or 'worst'
|
|
32
|
+
verbose: Enable verbose logging
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Path to downloaded file(s)
|
|
36
|
+
"""
|
|
37
|
+
downloader = InstagramDownloader(verbose=verbose)
|
|
38
|
+
return downloader.download(url, output_path, quality)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_info(url, verbose=False):
|
|
42
|
+
"""
|
|
43
|
+
Get media information without downloading
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
url: Instagram URL
|
|
47
|
+
verbose: Enable verbose logging
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Dictionary with media information
|
|
51
|
+
"""
|
|
52
|
+
downloader = InstagramDownloader(verbose=verbose)
|
|
53
|
+
return downloader.get_info(url)
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command-line interface for parth-dl
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import argparse
|
|
7
|
+
from . import __version__, __description__
|
|
8
|
+
from .core import InstagramDownloader
|
|
9
|
+
from .utils import DownloadError, RateLimitError, NetworkError, ValidationError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def print_banner():
|
|
13
|
+
"""Print application banner"""
|
|
14
|
+
banner = f"""
|
|
15
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
16
|
+
║ parth-dl v{__version__} ║
|
|
17
|
+
║ Instagram Media Downloader ║
|
|
18
|
+
║ (Public Content Only) ║
|
|
19
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
20
|
+
"""
|
|
21
|
+
print(banner)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def create_parser():
|
|
25
|
+
"""Create command-line argument parser"""
|
|
26
|
+
parser = argparse.ArgumentParser(
|
|
27
|
+
prog='parth-dl',
|
|
28
|
+
description=__description__,
|
|
29
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
30
|
+
epilog="""
|
|
31
|
+
Examples:
|
|
32
|
+
Download a reel:
|
|
33
|
+
parth-dl https://www.instagram.com/reel/ABC123/
|
|
34
|
+
|
|
35
|
+
Download a post:
|
|
36
|
+
parth-dl https://www.instagram.com/p/ABC123/
|
|
37
|
+
|
|
38
|
+
Download profile picture:
|
|
39
|
+
parth-dl https://www.instagram.com/username/
|
|
40
|
+
|
|
41
|
+
Download with custom output:
|
|
42
|
+
parth-dl https://www.instagram.com/reel/ABC123/ -o my_video.mp4
|
|
43
|
+
|
|
44
|
+
List available formats:
|
|
45
|
+
parth-dl https://www.instagram.com/reel/ABC123/ --list-formats
|
|
46
|
+
|
|
47
|
+
Enable verbose logging:
|
|
48
|
+
parth-dl https://www.instagram.com/reel/ABC123/ -v
|
|
49
|
+
|
|
50
|
+
Supported Content:
|
|
51
|
+
✓ Reels (with audio)
|
|
52
|
+
✓ Video posts (with audio)
|
|
53
|
+
✓ Image posts (single & carousel)
|
|
54
|
+
✓ Profile pictures
|
|
55
|
+
✗ Stories (requires authentication)
|
|
56
|
+
✗ Highlights (requires authentication)
|
|
57
|
+
✗ Private accounts (not supported)
|
|
58
|
+
|
|
59
|
+
Note: This tool only works with PUBLIC Instagram content.
|
|
60
|
+
"""
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Positional arguments
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
'url',
|
|
66
|
+
help='Instagram URL (post, reel, or profile)'
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Optional arguments
|
|
70
|
+
parser.add_argument(
|
|
71
|
+
'-o', '--output',
|
|
72
|
+
metavar='PATH',
|
|
73
|
+
help='Output file or directory path'
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
'-q', '--quality',
|
|
78
|
+
choices=['best', 'worst'],
|
|
79
|
+
default='best',
|
|
80
|
+
help='Video quality preference (default: best)'
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
parser.add_argument(
|
|
84
|
+
'-v', '--verbose',
|
|
85
|
+
action='store_true',
|
|
86
|
+
help='Enable verbose/debug output'
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
parser.add_argument(
|
|
90
|
+
'--list-formats',
|
|
91
|
+
action='store_true',
|
|
92
|
+
help='List all available formats without downloading'
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
parser.add_argument(
|
|
96
|
+
'--no-rate-limit',
|
|
97
|
+
action='store_true',
|
|
98
|
+
help='Disable rate limiting (not recommended)'
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
parser.add_argument(
|
|
102
|
+
'--version',
|
|
103
|
+
action='version',
|
|
104
|
+
version=f'%(prog)s {__version__}'
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return parser
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def main():
|
|
111
|
+
"""Main CLI entry point"""
|
|
112
|
+
parser = create_parser()
|
|
113
|
+
args = parser.parse_args()
|
|
114
|
+
|
|
115
|
+
# Print banner for non-quiet operations
|
|
116
|
+
if not args.list_formats:
|
|
117
|
+
print_banner()
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
# Create downloader instance
|
|
121
|
+
downloader = InstagramDownloader(
|
|
122
|
+
verbose=args.verbose,
|
|
123
|
+
rate_limit=not args.no_rate_limit
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Execute command
|
|
127
|
+
if args.list_formats:
|
|
128
|
+
downloader.list_formats(args.url)
|
|
129
|
+
else:
|
|
130
|
+
downloader.download(
|
|
131
|
+
url=args.url,
|
|
132
|
+
output_path=args.output,
|
|
133
|
+
quality=args.quality
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
return 0
|
|
137
|
+
|
|
138
|
+
except KeyboardInterrupt:
|
|
139
|
+
print("\n\n[parth-dl] ⚠ Download cancelled by user", file=sys.stderr)
|
|
140
|
+
return 130
|
|
141
|
+
|
|
142
|
+
except ValidationError as e:
|
|
143
|
+
print(f"\n[parth-dl] ✗ Invalid input: {e}", file=sys.stderr)
|
|
144
|
+
return 1
|
|
145
|
+
|
|
146
|
+
except RateLimitError as e:
|
|
147
|
+
print(f"\n[parth-dl] ✗ Rate limit error: {e}", file=sys.stderr)
|
|
148
|
+
print("Tip: Wait a few minutes before trying again.", file=sys.stderr)
|
|
149
|
+
return 1
|
|
150
|
+
|
|
151
|
+
except NetworkError as e:
|
|
152
|
+
print(f"\n[parth-dl] ✗ Network error: {e}", file=sys.stderr)
|
|
153
|
+
print("Tip: Check your internet connection and try again.", file=sys.stderr)
|
|
154
|
+
return 1
|
|
155
|
+
|
|
156
|
+
except DownloadError as e:
|
|
157
|
+
print(f"\n[parth-dl] ✗ Download failed: {e}", file=sys.stderr)
|
|
158
|
+
return 1
|
|
159
|
+
|
|
160
|
+
except Exception as e:
|
|
161
|
+
print(f"\n[parth-dl] ✗ Unexpected error: {e}", file=sys.stderr)
|
|
162
|
+
if args.verbose:
|
|
163
|
+
import traceback
|
|
164
|
+
traceback.print_exc()
|
|
165
|
+
return 1
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
if __name__ == '__main__':
|
|
169
|
+
sys.exit(main())
|