importly 0.1.0__py3-none-any.whl
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.
- importly/__init__.py +78 -0
- importly/_base.py +160 -0
- importly/_client.py +363 -0
- importly/_errors.py +198 -0
- importly/_types.py +302 -0
- importly/_version.py +1 -0
- importly/py.typed +0 -0
- importly/webhooks.py +116 -0
- importly-0.1.0.dist-info/METADATA +143 -0
- importly-0.1.0.dist-info/RECORD +12 -0
- importly-0.1.0.dist-info/WHEEL +4 -0
- importly-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: importly
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turn any video or audio link into files, transcripts and metadata from your Python app. Works from servers where downloads get blocked.
|
|
5
|
+
Project-URL: Homepage, https://www.importly.io/?utm_source=pypi&utm_medium=package&utm_campaign=guerrilla-2026-11
|
|
6
|
+
Project-URL: Documentation, https://www.importly.io/docs?utm_source=pypi&utm_medium=package&utm_campaign=guerrilla-2026-11
|
|
7
|
+
Project-URL: Repository, https://github.com/importly-io/importly-integrations/tree/main/python/importly
|
|
8
|
+
Project-URL: Issues, https://github.com/importly-io/importly-integrations/issues
|
|
9
|
+
Author-email: Importly <support@importly.io>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,audio,download,metadata,podcast,tiktok,transcript,video,youtube
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
17
|
+
Classifier: Topic :: Multimedia :: Video
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Requires-Dist: httpx<1,>=0.24
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
|
|
23
|
+
Requires-Dist: pytest>=7; extra == 'test'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# importly
|
|
27
|
+
|
|
28
|
+
Turn any video or audio link into files, transcripts and metadata from your Python app.
|
|
29
|
+
|
|
30
|
+
Send a link from YouTube, TikTok, X, Instagram, a podcast or 1,000+ other sites, and get back the file, a timestamped transcript or the metadata. It works from servers and agent sandboxes, where downloads usually get blocked. Free to try, no card required: [get an API key](https://www.importly.io/login?mode=signup&utm_source=pypi&utm_medium=package&utm_campaign=guerrilla-2026-11).
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install importly
|
|
34
|
+
export IMPORTLY_API_KEY=...
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Transcript
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from importly import Importly
|
|
41
|
+
|
|
42
|
+
client = Importly() # reads IMPORTLY_API_KEY
|
|
43
|
+
|
|
44
|
+
transcript = client.transcribe("https://www.youtube.com/watch?v=jNQXAC9IVRw")
|
|
45
|
+
print(transcript.text)
|
|
46
|
+
for segment in transcript.segments:
|
|
47
|
+
print(segment.start, segment.end, segment.text)
|
|
48
|
+
|
|
49
|
+
# Group segments into ~2-minute chunks for RAG, each with start/end times
|
|
50
|
+
for chunk in transcript.chunks(120):
|
|
51
|
+
print(chunk.start_timestamp, chunk.text[:80])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
By default the transcript comes from the media's captions. If there are none, `transcribe` raises `TranscriptionProviderRequiredError` with a `quote`; pass `provider="importly"` to use built-in speech-to-text, optionally with `max_cost_dollars`.
|
|
55
|
+
|
|
56
|
+
## File
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
result = client.import_media(
|
|
60
|
+
"https://www.tiktok.com/@scout2015/video/6718335390845095173",
|
|
61
|
+
video_quality="720p",
|
|
62
|
+
max_cost_dollars=0.10,
|
|
63
|
+
)
|
|
64
|
+
print(result.media_url) # signed download link, valid for 7 days
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Audio only: `include_video=False`. Copy straight to your own S3-compatible bucket: `store=True` (set up your bucket in the dashboard first).
|
|
68
|
+
|
|
69
|
+
## Metadata
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
preview = client.basic_metadata(url) # title, duration, thumbnail
|
|
73
|
+
meta = client.metadata(url) # description, uploader, stats, formats, ...
|
|
74
|
+
print(meta.title, meta.uploader, meta.view_count)
|
|
75
|
+
print(meta.raw) # every field the source returned
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Async
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import asyncio
|
|
82
|
+
from importly import AsyncImportly
|
|
83
|
+
|
|
84
|
+
async def main(urls):
|
|
85
|
+
async with AsyncImportly() as client:
|
|
86
|
+
return await asyncio.gather(*(client.transcribe(u) for u in urls))
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Webhooks instead of waiting
|
|
90
|
+
|
|
91
|
+
Every job runs in the background. The one-call helpers above poll until it's done. In a web app, start the job with a `webhook_url` and handle the result when it arrives:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
job = client.start_transcription(url, webhook_url="https://your-app.com/webhooks/importly?token=" + WEBHOOK_TOKEN)
|
|
95
|
+
save(job.job_id)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from importly.webhooks import parse_webhook, token_matches
|
|
100
|
+
|
|
101
|
+
@app.post("/webhooks/importly") # Flask
|
|
102
|
+
def importly_webhook():
|
|
103
|
+
if not token_matches(request.args.get("token"), WEBHOOK_TOKEN):
|
|
104
|
+
abort(401)
|
|
105
|
+
event = parse_webhook(request.get_data())
|
|
106
|
+
if event.succeeded and event.job_type == "transcribe":
|
|
107
|
+
store_transcript(event.job_id, event.result.text)
|
|
108
|
+
elif event.failed:
|
|
109
|
+
mark_failed(event.job_id, event.code, event.message)
|
|
110
|
+
return "", 204
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Each job gets one delivery and no retries, so keep a fallback: `client.get_job(job_type, job_id)` returns the job's current state. Webhooks aren't signed; use a secret token in the URL as above, and only act on job ids you started.
|
|
114
|
+
|
|
115
|
+
You can also do it in steps yourself: `start_import` / `get_import` / `wait_for_import`, and the same for `transcription`, `metadata` and `basic_metadata`.
|
|
116
|
+
|
|
117
|
+
## Errors
|
|
118
|
+
|
|
119
|
+
| Exception | When | What to do |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `AuthenticationError` (401) | Missing or wrong API key | Check `IMPORTLY_API_KEY` |
|
|
122
|
+
| `InsufficientBalanceError` (402) | Balance too low to start the job (`balance_required`) | Add credits |
|
|
123
|
+
| `InvalidURLError` (400, `INVALID_URL`) | The link isn't a valid or supported media URL | Fix the URL |
|
|
124
|
+
| `InvalidRequestError` (400) | Another bad parameter | Fix the request |
|
|
125
|
+
| `RateLimitError` (429) | Over the hourly limit (`retry_after` seconds) | Retried automatically when the wait is under a minute |
|
|
126
|
+
| `InternalServerError` (5xx) | Something broke on Importly's side | Status calls are retried; job starts are not, so they can't start twice |
|
|
127
|
+
| `JobFailedError` | The job ran and failed, e.g. `VIDEO_PRIVATE`, `MAX_COST_EXCEEDED` (`.code`, `.documentation_url`) | See the linked page |
|
|
128
|
+
| `TranscriptionProviderRequiredError` | No captions and no `provider` (`.quote`) | Retry with `provider="importly"` |
|
|
129
|
+
| `JobTimeoutError` | Still running when `timeout` ran out | Poll later or use a webhook |
|
|
130
|
+
|
|
131
|
+
All of them inherit from `ImportlyError`.
|
|
132
|
+
|
|
133
|
+
## Pricing
|
|
134
|
+
|
|
135
|
+
Pay as you go from a credit balance: transcripts from captions and metadata are $0.003 per link, downloads $0.002 per MB (min $0.01). See [pricing](https://www.importly.io/pricing?utm_source=pypi&utm_medium=package&utm_campaign=guerrilla-2026-11).
|
|
136
|
+
|
|
137
|
+
## Links
|
|
138
|
+
|
|
139
|
+
- [Docs](https://www.importly.io/docs?utm_source=pypi&utm_medium=package&utm_campaign=guerrilla-2026-11) and [API reference](https://www.importly.io/docs/api-reference?utm_source=pypi&utm_medium=package&utm_campaign=guerrilla-2026-11)
|
|
140
|
+
- LangChain: [`langchain-importly`](https://pypi.org/project/langchain-importly/). LlamaIndex: [`llama-index-readers-importly`](https://pypi.org/project/llama-index-readers-importly/)
|
|
141
|
+
- Support: support@importly.io
|
|
142
|
+
|
|
143
|
+
MIT licensed.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
importly/__init__.py,sha256=B3Duwpcar8LADK4iI6uBteZWxHuqp-KFH_e9uKoThZw,1778
|
|
2
|
+
importly/_base.py,sha256=UNjjRJZiyNghtHKCd6NO1RXM_9KIRVHC2l_6ostQXdg,5577
|
|
3
|
+
importly/_client.py,sha256=f4gqNg79pcaoXFopZlDtTKCKDNyewTufproi_caB0_4,15562
|
|
4
|
+
importly/_errors.py,sha256=ypSvggybGbObbycsdSD196h5qpbncqoD8HJjKByJ0AQ,6281
|
|
5
|
+
importly/_types.py,sha256=Bt6TsomzmhDncikhGJVIiR8UAaXG3h-p-Dus5VYES48,10607
|
|
6
|
+
importly/_version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
7
|
+
importly/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
importly/webhooks.py,sha256=9GDtzHvG6cxd4ZnRacG96x0kqpUqHxbX-BCUm3k8bQg,4256
|
|
9
|
+
importly-0.1.0.dist-info/METADATA,sha256=L6yjziikZkgVdk63rLKrXGztGBowkNIJUdxPVfG6ZLA,6480
|
|
10
|
+
importly-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
11
|
+
importly-0.1.0.dist-info/licenses/LICENSE,sha256=DM7rHwJ0ae3SFn-uVR_HVj6Vw6nKoBqX3QITy6M1sSY,1065
|
|
12
|
+
importly-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Importly
|
|
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.
|