Skip to content

Document how to use as library #642

@lyz-code

Description

@lyz-code

Hi, I intend to use gallery-dl as a library for a program to periodically fetch the selected sources.

I already do it with youtube-dl as it's documented in their docs.

Is there a simple way to do the following with gallery-dl?

ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
    'logger': MyLogger(),
    'progress_hooks': [my_hook],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])

I've seen in this issue that you can process one url:

>>> from gallery_dl import job
>>> j = job.DataJob("https://imgur.com/0gybAXR")
>>> j.run()
[ ... ]

But it doesn't downloads the file, nor it works with gallery links such as https://www.deviantart.com/{{ user }}
Thank you

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions