instapipe 0.1.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.
- instapipe-0.1.0/LICENSE +21 -0
- instapipe-0.1.0/PKG-INFO +361 -0
- instapipe-0.1.0/README.md +335 -0
- instapipe-0.1.0/pyproject.toml +47 -0
- instapipe-0.1.0/setup.cfg +4 -0
- instapipe-0.1.0/src/instapipe/__init__.py +3 -0
- instapipe-0.1.0/src/instapipe/__main__.py +5 -0
- instapipe-0.1.0/src/instapipe/classify.py +77 -0
- instapipe-0.1.0/src/instapipe/clean.py +97 -0
- instapipe-0.1.0/src/instapipe/cli.py +167 -0
- instapipe-0.1.0/src/instapipe/compare.py +72 -0
- instapipe-0.1.0/src/instapipe/dashboard.py +212 -0
- instapipe-0.1.0/src/instapipe/excel.py +233 -0
- instapipe-0.1.0/src/instapipe/ingest.py +102 -0
- instapipe-0.1.0/src/instapipe/insights.py +133 -0
- instapipe-0.1.0/src/instapipe/metrics.py +151 -0
- instapipe-0.1.0/src/instapipe/output.py +141 -0
- instapipe-0.1.0/src/instapipe.egg-info/PKG-INFO +361 -0
- instapipe-0.1.0/src/instapipe.egg-info/SOURCES.txt +30 -0
- instapipe-0.1.0/src/instapipe.egg-info/dependency_links.txt +1 -0
- instapipe-0.1.0/src/instapipe.egg-info/entry_points.txt +2 -0
- instapipe-0.1.0/src/instapipe.egg-info/requires.txt +12 -0
- instapipe-0.1.0/src/instapipe.egg-info/top_level.txt +1 -0
- instapipe-0.1.0/tests/test_classify.py +61 -0
- instapipe-0.1.0/tests/test_clean.py +87 -0
- instapipe-0.1.0/tests/test_cli.py +50 -0
- instapipe-0.1.0/tests/test_compare.py +45 -0
- instapipe-0.1.0/tests/test_excel.py +50 -0
- instapipe-0.1.0/tests/test_ingest.py +63 -0
- instapipe-0.1.0/tests/test_insights.py +92 -0
- instapipe-0.1.0/tests/test_metrics.py +116 -0
- instapipe-0.1.0/tests/test_output.py +73 -0
instapipe-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aroaxinping
|
|
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.
|
instapipe-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: instapipe
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Data pipeline for Instagram analytics. Your Meta Business Suite exports in, real metrics out.
|
|
5
|
+
Author: aroaxinping
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: instagram,analytics,data-pipeline,content-creator,reels
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pandas>=2.0
|
|
16
|
+
Requires-Dist: openpyxl>=3.1
|
|
17
|
+
Requires-Dist: matplotlib>=3.7
|
|
18
|
+
Requires-Dist: seaborn>=0.13
|
|
19
|
+
Provides-Extra: dashboard
|
|
20
|
+
Requires-Dist: plotly>=5.0; extra == "dashboard"
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff; extra == "dev"
|
|
24
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# instapipe
|
|
28
|
+
|
|
29
|
+
[](https://github.com/aroaxinping/instapipe/actions/workflows/ci.yml)
|
|
30
|
+

|
|
31
|
+

|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
Data pipeline for Instagram analytics. Import your exported data from Meta Business Suite, clean it, compute real metrics, and visualize what actually works.
|
|
35
|
+
|
|
36
|
+
No APIs, no scraping, no third-party tokens. Just your Instagram export files (CSV/XLSX) and Python.
|
|
37
|
+
|
|
38
|
+
### Why instapipe?
|
|
39
|
+
|
|
40
|
+
Most Instagram analytics tools are either paid dashboards, require API tokens, or scrape data in ways that break with every update. instapipe takes a different approach: you export your own data from Meta Business Suite (a manual download, 30 seconds), and instapipe does the rest — cleaning, metric computation, and visualization. You own your data, you control the pipeline, and you can extend it however you want.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## What it generates
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<img src="examples/output/engagement.png" alt="Engagement Rate Distribution" width="48%"/>
|
|
48
|
+
<img src="examples/output/best_hours.png" alt="Best Posting Hours" width="48%"/>
|
|
49
|
+
</p>
|
|
50
|
+
<p align="center">
|
|
51
|
+
<img src="examples/output/top_reels.png" alt="Top Reels by Engagement" width="48%"/>
|
|
52
|
+
<img src="examples/output/save_rate.png" alt="Save Rate vs Engagement" width="48%"/>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
> Generated from sample data included in `examples/`. Try it yourself:
|
|
56
|
+
> ```bash
|
|
57
|
+
> instapipe analyze examples/sample_data.csv --output results/
|
|
58
|
+
> ```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Architecture
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
instapipe follows a classic ETL pipeline structure:
|
|
66
|
+
|
|
67
|
+
Export (Meta Business Suite CSV/XLSX)
|
|
68
|
+
|
|
|
69
|
+
v
|
|
70
|
+
+-----------+
|
|
71
|
+
| ingest | --> Load and validate raw export files (utf-8-sig & utf-16)
|
|
72
|
+
+-----------+
|
|
73
|
+
|
|
|
74
|
+
v
|
|
75
|
+
+-----------+
|
|
76
|
+
| clean | --> Normalize columns (ES/EN), fix types, parse dates
|
|
77
|
+
+-----------+
|
|
78
|
+
|
|
|
79
|
+
v
|
|
80
|
+
+-----------+
|
|
81
|
+
| metrics | --> Compute engagement, save rate, share rate, conversion
|
|
82
|
+
+-----------+
|
|
83
|
+
|
|
|
84
|
+
v
|
|
85
|
+
+-----------+
|
|
86
|
+
| output | --> Dataframes, CSV export, visualizations
|
|
87
|
+
+-----------+
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Modules
|
|
91
|
+
|
|
92
|
+
| Module | What it does |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `instapipe.ingest` | Reads Instagram export files (CSV, XLSX). Handles Meta Business Suite's utf-16 daily CSVs and utf-8-sig content CSVs transparently. |
|
|
95
|
+
| `instapipe.clean` | Maps column names (Spanish/English) to internal names, converts date/number types, parses publication time into date, hour, and day of week. |
|
|
96
|
+
| `instapipe.metrics` | Computes derived metrics: engagement rate (based on reach), save rate, share rate, follower conversion rate, best posting hour/day. |
|
|
97
|
+
| `instapipe.output` | Exports results to CSV/JSON. Generates matplotlib/seaborn visualizations (engagement distribution, best hours, save rate scatter, top reels). |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Requirements
|
|
102
|
+
|
|
103
|
+
### 1. Instagram Professional Account (Creator or Business)
|
|
104
|
+
|
|
105
|
+
The free personal Instagram account does not give you access to analytics. You need to switch to a **Professional** account — it's free and takes 30 seconds.
|
|
106
|
+
|
|
107
|
+
**How to switch:**
|
|
108
|
+
1. Open Instagram > your profile > **Settings and privacy**
|
|
109
|
+
2. Scroll to **Account type and tools** > **Switch to professional account**
|
|
110
|
+
3. Choose **Creator** (recommended for content creators) or **Business**
|
|
111
|
+
4. Pick a category that describes you (e.g. Digital Creator, Personal Blog, Entrepreneur)
|
|
112
|
+
5. Tap **Done**
|
|
113
|
+
|
|
114
|
+
Once you switch, Instagram starts collecting analytics for your account. You'll see a new **Insights** button on your profile and on each post.
|
|
115
|
+
|
|
116
|
+
> **Note:** Instagram only starts tracking metrics from the moment you switch. You won't have historical data from before the switch. If you just switched, wait at least 7 days and publish some content before exporting — otherwise you'll have an empty file.
|
|
117
|
+
|
|
118
|
+
### 2. Meta Business Suite (free)
|
|
119
|
+
|
|
120
|
+
Meta Business Suite is the web tool where you export your Instagram data as CSV files. It's free, provided by Meta, and automatically available when you have a professional Instagram account.
|
|
121
|
+
|
|
122
|
+
**How to access it:**
|
|
123
|
+
1. Go to [business.facebook.com](https://business.facebook.com) from a desktop browser
|
|
124
|
+
2. Log in with the **Facebook account linked to your Instagram** — if you don't have one linked, Instagram prompts you to create or connect a Facebook Page when you switch to a professional account
|
|
125
|
+
3. Once inside, click **Insights** in the left sidebar
|
|
126
|
+
4. Make sure your Instagram account appears at the top — if it does, you're ready to export
|
|
127
|
+
|
|
128
|
+
> **Don't have a Facebook account linked?** Go to Instagram > Settings > Accounts Center > Accounts > Add Facebook account. You need this connection for Meta Business Suite to see your Instagram data.
|
|
129
|
+
|
|
130
|
+
### 3. Export your data
|
|
131
|
+
|
|
132
|
+
instapipe works with CSV files exported from Meta Business Suite. There are two types:
|
|
133
|
+
|
|
134
|
+
#### Content/Posts CSV (the main one — required)
|
|
135
|
+
|
|
136
|
+
This is the file with one row per Reel/post and all the metrics for each one.
|
|
137
|
+
|
|
138
|
+
1. Open [Meta Business Suite](https://business.facebook.com) > **Insights** > **Content**
|
|
139
|
+
2. Filter by **Instagram** (top left, make sure you're not looking at Facebook)
|
|
140
|
+
3. Select the **date range** you want to analyze (e.g. last 28 days)
|
|
141
|
+
4. Click **Export** (top right corner) > choose **CSV**
|
|
142
|
+
5. A file like `Contenido_Posts_Feb24_Mar23.csv` downloads
|
|
143
|
+
|
|
144
|
+
This CSV includes: description, publication time, views, reach, likes, comments, saves, shares, followers gained, duration, and permalink for each Reel/post.
|
|
145
|
+
|
|
146
|
+
#### Daily metric CSVs (optional — for trend analysis)
|
|
147
|
+
|
|
148
|
+
These are individual CSVs with one data point per day for a specific metric (e.g. daily reach, daily views).
|
|
149
|
+
|
|
150
|
+
1. Open Meta Business Suite > **Insights** > **Overview**
|
|
151
|
+
2. For each metric you want (Reach, Views, Followers, Interactions, Profile visits), click the small **Export** icon next to it
|
|
152
|
+
3. Each one downloads as a separate CSV (e.g. `Alcance.csv`, `Visualizaciones.csv`, `Seguidores.csv`)
|
|
153
|
+
|
|
154
|
+
These files use **utf-16 encoding** with a 3-line header — instapipe handles this automatically, you don't need to do anything special.
|
|
155
|
+
|
|
156
|
+
### 4. Python >= 3.10
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
python3 --version # Should be 3.10 or higher
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
All Python dependencies are installed automatically when you run `pip install`: pandas, openpyxl, matplotlib, seaborn.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Installation
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Clone the repo
|
|
170
|
+
git clone https://github.com/aroaxinping/instapipe.git
|
|
171
|
+
cd instapipe
|
|
172
|
+
|
|
173
|
+
# Create a virtual environment (recommended)
|
|
174
|
+
python -m venv .venv
|
|
175
|
+
source .venv/bin/activate
|
|
176
|
+
|
|
177
|
+
# Install in editable mode with all dependencies
|
|
178
|
+
pip install -e .
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Usage
|
|
184
|
+
|
|
185
|
+
### 1. Quick run (CLI)
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
instapipe analyze path/to/Contenido_Posts.csv --output results/
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
This runs the full pipeline (ingest -> clean -> metrics -> output) and saves a CSV report + charts to the output directory.
|
|
192
|
+
|
|
193
|
+
### 2. Python API
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
from instapipe import ingest, clean, metrics, output
|
|
197
|
+
|
|
198
|
+
# Load your content/posts export
|
|
199
|
+
raw = ingest.load("path/to/Contenido_Posts.csv")
|
|
200
|
+
|
|
201
|
+
# Clean and normalize
|
|
202
|
+
df = clean.normalize(raw)
|
|
203
|
+
|
|
204
|
+
# Compute metrics
|
|
205
|
+
report = metrics.compute(df)
|
|
206
|
+
|
|
207
|
+
# Print summary
|
|
208
|
+
print(report.summary())
|
|
209
|
+
|
|
210
|
+
# Export results
|
|
211
|
+
output.to_csv(report, "results.csv")
|
|
212
|
+
|
|
213
|
+
# Generate visualizations
|
|
214
|
+
output.plot_engagement(report, save_to="engagement.png")
|
|
215
|
+
output.plot_best_hours(report, save_to="best_hours.png")
|
|
216
|
+
output.plot_save_rate(report, save_to="save_rate.png")
|
|
217
|
+
output.plot_top_reels(report, save_to="top_reels.png")
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 3. Daily metrics (optional)
|
|
221
|
+
|
|
222
|
+
For the individual daily metric CSVs exported from Meta Business Suite Overview:
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from instapipe.ingest import load_daily
|
|
226
|
+
|
|
227
|
+
views = load_daily("Visualizaciones.csv", "visualizaciones")
|
|
228
|
+
reach = load_daily("Alcance.csv", "alcance")
|
|
229
|
+
followers = load_daily("Seguidores.csv", "seguidores_ganados")
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Available metrics
|
|
235
|
+
|
|
236
|
+
| Metric | Formula | Why this denominator |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| Engagement rate | (likes + comments + saves + shares) / reach x 100 | Reach = unique accounts. Industry standard for Instagram. |
|
|
239
|
+
| Save rate | saves / reach x 100 | Saves are the strongest quality signal on Instagram. |
|
|
240
|
+
| Share rate | shares / views x 100 | Shares drive distribution, measured against total impressions. |
|
|
241
|
+
| Follower conversion | followers gained / reach x 100 | How efficiently a Reel converts viewers into followers. |
|
|
242
|
+
| Best posting hour | Hour with highest median engagement | Based on your own data, not generic advice. |
|
|
243
|
+
| Best posting day | Day of week with highest median engagement | Same — your audience, your data. |
|
|
244
|
+
| Top performers | Reels above 90th percentile engagement | Focus on what actually works for you. |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Instagram vs TikTok metrics
|
|
249
|
+
|
|
250
|
+
If you also use TikTok, check out [tokpipe](https://github.com/aroaxinping/tokpipe) — same philosophy, adapted for TikTok exports.
|
|
251
|
+
|
|
252
|
+
Key differences:
|
|
253
|
+
- **Instagram** uses **reach** (unique accounts) as the engagement denominator. **TikTok** uses **views** (total plays).
|
|
254
|
+
- Instagram exports come from **Meta Business Suite** (utf-16 daily CSVs + utf-8-sig content CSVs). TikTok exports come from **TikTok Studio** (XLSX/CSV).
|
|
255
|
+
- Instagram has **saves** as a key metric. TikTok has **watch time** and **completion rate**.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Try it without an Instagram account
|
|
260
|
+
|
|
261
|
+
The repo includes a sample CSV with 10 fake reels so you can try the full pipeline immediately:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# After installation
|
|
265
|
+
instapipe analyze examples/sample_data.csv --output results/
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This generates:
|
|
269
|
+
- `results/report.csv` — cleaned data with all computed metrics
|
|
270
|
+
- `results/engagement.png` — engagement rate distribution
|
|
271
|
+
- `results/best_hours.png` — best posting hours
|
|
272
|
+
- `results/save_rate.png` — save rate vs engagement scatter
|
|
273
|
+
- `results/top_reels.png` — top reels by engagement rate
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Troubleshooting
|
|
278
|
+
|
|
279
|
+
### `ModuleNotFoundError: No module named 'instapipe'`
|
|
280
|
+
|
|
281
|
+
You haven't installed instapipe or your virtual environment isn't active.
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
source .venv/bin/activate # activate the venv
|
|
285
|
+
pip install -e . # install instapipe
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### `ValueError: Could not find a reach or views column`
|
|
289
|
+
|
|
290
|
+
Your CSV column names don't match what instapipe expects. This usually happens when Meta Business Suite exports in a language other than Spanish or English.
|
|
291
|
+
|
|
292
|
+
Check your CSV header row:
|
|
293
|
+
```bash
|
|
294
|
+
head -1 your_file.csv
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
If the columns are in another language, open an issue with the header row and we'll add support for it.
|
|
298
|
+
|
|
299
|
+
### `UnicodeDecodeError` when loading a daily metric CSV
|
|
300
|
+
|
|
301
|
+
Use `load_daily()` instead of `load()` for the individual daily metric CSVs (Alcance.csv, Visualizaciones.csv, etc.) — they use utf-16 encoding:
|
|
302
|
+
|
|
303
|
+
```python
|
|
304
|
+
from instapipe.ingest import load_daily
|
|
305
|
+
df = load_daily("Alcance.csv", "alcance")
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### `FileNotFoundError`
|
|
309
|
+
|
|
310
|
+
Double-check the path to your CSV file. If your file has spaces in the name, wrap the path in quotes:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
instapipe analyze "path/to/My Export File.csv"
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Charts look wrong or empty
|
|
317
|
+
|
|
318
|
+
Make sure your CSV has at least 3-5 rows of data. Charts generated from 1-2 reels won't be very informative.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Project structure
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
instapipe/
|
|
326
|
+
src/
|
|
327
|
+
instapipe/
|
|
328
|
+
__init__.py # Package init, version
|
|
329
|
+
ingest.py # Load Meta Business Suite exports
|
|
330
|
+
clean.py # Normalize and clean data
|
|
331
|
+
metrics.py # Compute derived metrics
|
|
332
|
+
output.py # Export and visualize
|
|
333
|
+
cli.py # Command-line interface
|
|
334
|
+
tests/
|
|
335
|
+
test_ingest.py
|
|
336
|
+
test_clean.py
|
|
337
|
+
test_metrics.py
|
|
338
|
+
examples/
|
|
339
|
+
sample_data.csv # Fake dataset (10 reels) for testing
|
|
340
|
+
output/ # Pre-generated charts from sample data
|
|
341
|
+
basic_analysis.py # Minimal working example
|
|
342
|
+
.github/
|
|
343
|
+
workflows/ci.yml # CI pipeline (pytest on Python 3.10-3.13)
|
|
344
|
+
ISSUE_TEMPLATE/ # Bug report & feature request templates
|
|
345
|
+
pyproject.toml # Package config
|
|
346
|
+
LICENSE
|
|
347
|
+
CONTRIBUTING.md
|
|
348
|
+
README.md
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Contributing
|
|
354
|
+
|
|
355
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## License
|
|
360
|
+
|
|
361
|
+
MIT. See [LICENSE](LICENSE).
|