initial import
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
# /// script
|
||||
# requires-python = ">=3.12"
|
||||
# dependencies = [
|
||||
# "instagram-dlpy",
|
||||
# ]
|
||||
# ///
|
||||
from pathlib import Path
|
||||
from typing import Annotated
|
||||
from instagramdl.api import get_post_data # type: ignore
|
||||
from instagramdl.parser import parse_api_response # type: ignore
|
||||
import typer
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@app.command()
|
||||
def download(
|
||||
post_url: Annotated[str, typer.Argument(help="post url")],
|
||||
download: Annotated[bool, typer.Option()] = True,
|
||||
):
|
||||
raw_data = get_post_data(post_url)
|
||||
parsed_data = parse_api_response(raw_data)
|
||||
if download:
|
||||
print(parsed_data.download(download_path=Path("~/Downloads").expanduser()))
|
||||
else:
|
||||
print(parsed_data.video_url)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app()
|
||||
Reference in New Issue
Block a user