aboutsummaryrefslogtreecommitdiff
path: root/src/download.c
blob: 6c8e33ef2100ec608ae3070bfa4450a33833f3ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "download.h"
#include "buffer.h"
#include "program.h"

int download_to_buffer(const char *url, Buffer *buffer) {
    const char *args[] = {
        "curl", "-s", "-L", "-f",
        "-H", "user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
        "-H", "Accept-Language: en-US,en;q=0.5",
        "--compressed",
        "--",
        url,
        NULL
    };
    return program_exec(args, program_buffer_write_callback, buffer);
}