JCMais / node-libcurl

libcurl bindings for Node.js
https://npmjs.org/package/node-libcurl
MIT License
666 stars 118 forks source link

How to build with curl-impersonate #352

Closed SwapnilSoni1999 closed 2 years ago

SwapnilSoni1999 commented 2 years ago

I tried building gyp build with these config but seems like its not getting compiled i guess

'variables': {
    # Comma separated list
    'curl_include_dirs%': '/home/sonisins/live/hehe/install/include',
    'curl_libraries%': '/home/sonisins/live/hehe/install/lib',
    'curl_static_build%': 'false',
    'curl_config_bin%': '/home/sonisins/live/hehe/install/bin/curl-config',
    'node_libcurl_no_setlocale%': 'false',
    'node_libcurl_cpp_std%': '<!(node <(module_root_dir)/scripts/cpp-std.js)',
    'macos_universal_build%': 'false',
  },

Here are the curl-impersonate files are (incase required) image

Also can you help writing this request in js

curl -X GET https://google.com \
    --ciphers TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-CHACHA20-POLY1305,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-SHA,ECDHE-RSA-AES256-SHA,AES128-GCM-SHA256,AES256-GCM-SHA384,AES128-SHA,AES256-SHA \
    -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"' \
    -H 'sec-ch-ua-mobile: ?0' \
    -H 'sec-ch-ua-platform: "Windows"' \
    -H 'Upgrade-Insecure-Requests: 1' \
    -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36' \
    -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
    -H 'Sec-Fetch-Site: none' \
    -H 'Sec-Fetch-Mode: navigate' \
    -H 'Sec-Fetch-User: ?1' \
    -H 'Sec-Fetch-Dest: document' \
    -H 'Accept-Encoding: gzip, deflate, br' \
    -H 'Accept-Language: en-US,en;q=0.9' \
    --http2 --false-start --compressed \
    --tlsv1.2 --no-npn --alps \
    --cert-compression brotli
JCMais commented 2 years ago

Hi @SwapnilSoni1999. I am not having a lot of time to investigate custom compilation issues right now. What errors are you getting when compiling it?

About your question on the curl CLI, what I would recommend is using the --libcurl option, which will allow you to save a .c version of the CLI, from there you can see all options it is using, and then convert that to Node.js. Sorry if that is not that helpful.

SwapnilSoni1999 commented 2 years ago

Heya @JCMais thanks for response. I've actually built one for now its not that robust build but it works Huge thanks to your bindings <3 Heres the forked repo: https://github.com/SwapnilSoni1999/node-libcurl-impersonate

JCMais commented 2 years ago

Awesome, glad you got it to work!

ibrah3m commented 1 year ago

Hi I'm interested in this topic and I wish it gets the interest, I were also trying this fork and went through ao much pain to get it half work after merging the current edit's. I really need to understand how to add unsupported options cuz I faced compiler issues.