summaryrefslogtreecommitdiff
path: root/src/extractors/extractor.c
blob: ccc1ec6e39f73566c5151dad9b1f1dc6c0cba1af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdlib.h>

#include "../utils/utils.h"
#include "bilibili.h"
#include "extractor.h"
#include "haokan.h"

Site_map site_map = {
    {{"www.bilibili.com", SITE_BILIBILI}, {"haokan.baidu.com", SITE_HAOKAN}},
    2};

void options_cleanup(Options *options) {
  free_and_nullify(options->URL);
  free_and_nullify(options->path);
  free_and_nullify(options->query);
  free_and_nullify(options->pagedata);
}

int extract(void *v) {
  Options *options = (Options *)v;
  switch (options->site) {
  case SITE_BILIBILI:
    bilibili_extract(options);
    break;
  case SITE_HAOKAN:
    haokan_extract(options);
    break;
  }
  options_cleanup(options);
  return 0;
}