instaloader: change working directory to instaloader
Signed-off-by: staylightblow8 <liudf0716@gmail.com>
This commit is contained in:
@@ -25,9 +25,15 @@ instaloader_worker(void *param)
|
||||
struct instaloader_param *p = (struct instaloader_param *)param;
|
||||
debug(LOG_DEBUG, "instaloader: action: %s, profile: %s\n", p->action, p->profile);
|
||||
char cmd[512] = {0};
|
||||
|
||||
// create directory instaloader and change current directory to it
|
||||
snprintf(cmd, sizeof(cmd), "mkdir -p instaloader && cd instaloader");
|
||||
debug(LOG_DEBUG, "instaloader: cmd: %s\n", cmd);
|
||||
system(cmd);
|
||||
|
||||
if (strcmp(p->action, "download") == 0) {
|
||||
// download profile
|
||||
snprintf(cmd, 200, "instaloader --no-captions --no-metadata-json --no-compress-json --no-pictures %s", p->profile);
|
||||
snprintf(cmd, sizeof(cmd), "instaloader --no-captions --no-metadata-json --no-compress-json --no-pictures %s", p->profile);
|
||||
debug(LOG_DEBUG, "instaloader: cmd: %s\n", cmd);
|
||||
// use popen to execute cmd and get its output
|
||||
FILE *fp = popen(cmd, "r");
|
||||
@@ -50,7 +56,6 @@ instaloader_worker(void *param)
|
||||
debug(LOG_ERR, "instaloader: unknown action: %s\n", p->action);
|
||||
}
|
||||
|
||||
|
||||
// free param
|
||||
free(param);
|
||||
|
||||
@@ -204,6 +209,8 @@ instaloader_service(void *local_port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
debug(LOG_DEBUG, "instaloader: start instaloader service on port %d\n", port);
|
||||
|
||||
// Set up a callback function for handling HTTP requests
|
||||
evhttp_set_cb(http, "/", http_post_cb, NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user