diff options
author | Mole Shang <[email protected]> | 2023-08-09 17:29:15 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2023-08-09 17:30:30 +0800 |
commit | c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6 (patch) | |
tree | 3ca0539da181565257d41259cc8e539c469fe847 /src/extractors | |
parent | c952d1663bf8d7e54926faab23ed2291c68b73f2 (diff) | |
download | hinata-c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6.tar.gz hinata-c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6.tar.bz2 hinata-c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6.zip |
process_url: set referer in the separate function
Diffstat (limited to 'src/extractors')
-rw-r--r-- | src/extractors/bilibili.c | 8 | ||||
-rw-r--r-- | src/extractors/haokan.c | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/extractors/bilibili.c b/src/extractors/bilibili.c index aa3fc4e..5b98f26 100644 --- a/src/extractors/bilibili.c +++ b/src/extractors/bilibili.c @@ -404,16 +404,16 @@ static int download(Bilibili_options *bilibili_options) { callback_struct.videofn = malloc(strlen(callback_struct.filename) + 6); sprintf(callback_struct.videofn, "%s[%s]-%s.%s", bilibili_options->title, quality_desc, "video", ext); - add_url(video->baseUrl, NULL, callback_struct.videofn, - "https://www.bilibili.com", NULL, NULL); + set_referer("https://www.bilibili.com"); + add_url(video->baseUrl, NULL, callback_struct.videofn, NULL, NULL); } { callback_struct.audiofn = malloc(strlen(callback_struct.filename) + 6); sprintf(callback_struct.audiofn, "%s[%s]-%s.%s", bilibili_options->title, quality_desc, "audio", mimeType2ext(audio->mimeType)); - add_url(audio->baseUrl, NULL, callback_struct.audiofn, - "https://www.bilibili.com", &bilibili_merge, &callback_struct); + add_url(audio->baseUrl, NULL, callback_struct.audiofn, &bilibili_merge, + &callback_struct); } free_and_nullify(resp); dash_cleanup(&dash); diff --git a/src/extractors/haokan.c b/src/extractors/haokan.c index 5659018..f289c3e 100644 --- a/src/extractors/haokan.c +++ b/src/extractors/haokan.c @@ -33,7 +33,8 @@ void haokan_extract(Options *options) { char *filename = malloc(strlen(title) + strlen(ct) + 2); sprintf(filename, "%s.%s", title, ext); - add_url(videoURL, NULL, filename, "https://haokan.baidu.com", NULL, NULL); + set_referer("https://haokan.baidu.com"); + add_url(videoURL, NULL, filename, NULL, NULL); end: free_str_array(&results); |