将cURL命令转换为RestSharp

时间:2018-08-24 20:03:17

标签: c# .net curl restsharp

我正在尝试将此curl命令转换为RestSharp。

curl -k -insecure "https://accounts.google.com/_/signin/sl/lookup?hl=tr^&_reqid=66671^&rt=j" 
-H "cookie: __utmx=173272373.NsRgTn8iQf-MYLOX8BH_qA$0:1; __utmxx=173272373.NsRgTn8iQf-MYLOX8BH_qA$0:1517368307:8035200; NID=122=BFvhCUC91Ouv2JSon7hCthjSLIFcMVr4xC_rFlQVdfBM2tX2Qk2DxpLo4mJjpiq9KnBeFk3UBBJiBK8cMhhC6hj-yPTtO5qVAbPFYJlmYg3Legyizsc0oFjHRi3wb1ce; 1P_JAR=2018-1-31-4; GAPS=1:aphXL8Pq78iDUwyvos0EnnsDaCax_A:7fOKSRgItT3vXT7t" 
-H "x-same-domain: 1" 
-H "origin: https://accounts.google.com" 
-H "accept-encoding: gzip, deflate, br" 
-H "accept-language: en-US,en;q=0.9" 
-H "x-chrome-id-consistency-request: version=1,client_id=77185425430.apps.googleusercontent.com,signin_mode=all_accounts,signout_mode=no_confirmation" 
-H "google-accounts-xsrf: 1" 
-H "x-client-data: CIy2yQEIprbJAQjEtskBCKmdygEI153KAQjZncoBCKijygE=" 
-H "user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/63.0.3239.84 Chrome/63.0.3239.84 Safari/537.36" 
-H "content-type: application/x-www-form-urlencoded;charset=UTF-8" 
-H "accept: */*" 
-H "referer: https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin" 
-H "authority: accounts.google.com" 
-H "google-accounts-xsrf: 1" 
--data {you can see below} --compressed

以下是示例数据:

"continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin&f.req=%5B%22mkavraz521453%22%2C%22AEThLlyIe_NE6hsc-RZLM1yf4i3sxNVIWMfKJh1ZBTaWVmedPJH9g2PevUirRqkUkUBW8SY8BOgrU_bj9eWNcyQh1Lx67IIni7xWWPaay3eUqV7bEdKzeCM68RiSgf6hoCHRpk0ft0Y5jXmPQn7k38QWllMEydDt9g%22%2C%5B%5D%2Cnull%2C%22US%22%2Cnull%2Cnull%2C2%2Cfalse%2Ctrue%2C%5Bnull%2Cnull%2C%5B2%2C1%2Cnull%2C1%2C%22https%3A%2F%2Faccounts.google.com%2FServiceLogin%3Fcontinue%3Dhttps%253A%252F%252Fmail.google.com%252Fmail%252F%26service%3Dmail%26sacu%3D1%26rip%3D1%26flowName%3DGlifWebSignIn%26flowEntry%3DServiceLogin%22%2Cnull%2C%5B%5D%2C4%5D%2C1%2C%5Bnull%2Cnull%2C%5B%5D%5D%2Cnull%2Cnull%2Cnull%2Ctrue%5D%2C%22mkavraz521453%22%5D&bgRequest=%5B%22identifier%22%2C%22!3t2l3fxCrGbeAIqulZBESKxL7Ag_7B0CAAAAMFIAAAAamQFyvifcswrWstdeU9DuOGG4Tr2ZuaTQFR3XZGTcGX6v0wlNNJ8j71rRzE7yIfXx4lNYWEzB6N-VBH1OUT1rAisjaHNH2XjXonrnkpOib-xdKANaty3bckSYeJ88p9Z_J0_KwtCj6nQKV3CVZRNUjZa48H4rwyAD1752H0jty5unB6YepbcdGveaSGgFfSTN0ASEg2JEmdbL0CbjFXI_ZArf75ypKA6olDPeKk_MKCNHfWXn3F0dVjHBdLFSSfeif9F8eIFA-whgprLZ6SqzX8W7P2Dya-1r8nW7gxzo3UOPQ6xOoPBnmF1cJkKLdU7GSssduI04GyiNWBWdL5NiGqSeA_IcVUEry10I1H94rN9cqzEP7B_SCkBdnbx7Zz3msrZNBl0ZTqgkGVEPx_9lcOHkOn4ivJ3fFA_CcjpwFALTXlKQDBoMqpTqLvGCbH1cUTErbKvjkQar4QTnXcLYDPPIkG_-mQLT0UWNf31FSoS7--mX_g%22%5D&azt=AFoagUXY1TjmBb8ilL3USd72opbUFeW_wQ%3A1517376320095&cookiesDisabled=false&deviceinfo=%5Bnull%2Cnull%2Cnull%2C%5B%5D%2Cnull%2C%22US%22%2Cnull%2Cnull%2C%5B%5D%2C%22GlifWebSignIn%22%2Cnull%2C%5Bnull%2Cnull%2C%5B%5D%5D%5D&gmscoreversion=undefined&checkConnection=youtube%3A601%3A1&checkedDomains=youtube&pstMsg=1"

这是我正在尝试使用RestSharp的方法:

var client = new RestClient("https://accounts.google.com/_/signin/sl/lookup?hl=tr^&_reqid=66671^&rt=j");
var request = new RestRequest(Method.POST);
            request.AddHeader("cookie", "__utmx=173272373.NsRgTn8iQf-MYLOX8BH_qA$0:1; __utmxx=173272373.NsRgTn8iQf-MYLOX8BH_qA$0:1517368307:8035200; NID=122=BFvhCUC91Ouv2JSon7hCthjSLIFcMVr4xC_rFlQVdfBM2tX2Qk2DxpLo4mJjpiq9KnBeFk3UBBJiBK8cMhhC6hj-yPTtO5qVAbPFYJlmYg3Legyizsc0oFjHRi3wb1ce; 1P_JAR=2018-1-31-4; GAPS=1:aphXL8Pq78iDUwyvos0EnnsDaCax_A:7fOKSRgItT3vXT7t");
request.AddHeader("x-same-domain", "1");
request.AddHeader("origin", "https://accounts.google.com");
request.AddHeader("accept-encoding", "gzip, deflate, br");
request.AddHeader("accept-language", "en-US,en;q=0.9");
request.AddHeader("x-chrome-id-consistency-request", "version=1,client_id=77185425430.apps.googleusercontent.com,signin_mode=all_accounts,signout_mode=no_confirmation");
request.AddHeader("google-accounts-xsrf", "1");
request.AddHeader("x-client-data", "CIy2yQEIprbJAQjEtskBCKmdygEI153KAQjZncoBCKijygE=");
request.AddHeader("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/63.0.3239.84 Chrome/63.0.3239.84 Safari/537.36");
request.AddHeader("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
request.AddHeader("accept", "*/*");
request.AddHeader("referer", "https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin");
request.AddHeader("authority", "accounts.google.com");
request.AddBody(
    "continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin&f.req=%5B%22mkavraz52%22%2C%22AEThLlyIe_NE6hsc-RZLM1yf4i3sxNVIWMfKJh1ZBTaWVmedPJH9g2PevUirRqkUkUBW8SY8BOgrU_bj9eWNcyQh1Lx67IIni7xWWPaay3eUqV7bEdKzeCM68RiSgf6hoCHRpk0ft0Y5jXmPQn7k38QWllMEydDt9g%22%2C%5B%5D%2Cnull%2C%22US%22%2Cnull%2Cnull%2C2%2Cfalse%2Ctrue%2C%5Bnull%2Cnull%2C%5B2%2C1%2Cnull%2C1%2C%22https%3A%2F%2Faccounts.google.com%2FServiceLogin%3Fcontinue%3Dhttps%253A%252F%252Fmail.google.com%252Fmail%252F%26service%3Dmail%26sacu%3D1%26rip%3D1%26flowName%3DGlifWebSignIn%26flowEntry%3DServiceLogin%22%2Cnull%2C%5B%5D%2C4%5D%2C1%2C%5Bnull%2Cnull%2C%5B%5D%5D%2Cnull%2Cnull%2Cnull%2Ctrue%5D%2C%22mkavraz52%22%5D&bgRequest=%5B%22identifier%22%2C%22!3t2l3fxCrGbeAIqulZBESKxL7Ag_7B0CAAAAMFIAAAAamQFyvifcswrWstdeU9DuOGG4Tr2ZuaTQFR3XZGTcGX6v0wlNNJ8j71rRzE7yIfXx4lNYWEzB6N-VBH1OUT1rAisjaHNH2XjXonrnkpOib-xdKANaty3bckSYeJ88p9Z_J0_KwtCj6nQKV3CVZRNUjZa48H4rwyAD1752H0jty5unB6YepbcdGveaSGgFfSTN0ASEg2JEmdbL0CbjFXI_ZArf75ypKA6olDPeKk_MKCNHfWXn3F0dVjHBdLFSSfeif9F8eIFA-whgprLZ6SqzX8W7P2Dya-1r8nW7gxzo3UOPQ6xOoPBnmF1cJkKLdU7GSssduI04GyiNWBWdL5NiGqSeA_IcVUEry10I1H94rN9cqzEP7B_SCkBdnbx7Zz3msrZNBl0ZTqgkGVEPx_9lcOHkOn4ivJ3fFA_CcjpwFALTXlKQDBoMqpTqLvGCbH1cUTErbKvjkQar4QTnXcLYDPPIkG_-mQLT0UWNf31FSoS7--mX_g%22%5D&azt=AFoagUXY1TjmBb8ilL3USd72opbUFeW_wQ%3A1517376320095&cookiesDisabled=false&deviceinfo=%5Bnull%2Cnull%2Cnull%2C%5B%5D%2Cnull%2C%22US%22%2Cnull%2Cnull%2C%5B%5D%2C%22GlifWebSignIn%22%2Cnull%2C%5Bnull%2Cnull%2C%5B%5D%5D%5D&gmscoreversion=undefined&checkConnection=youtube%3A601%3A1&checkedDomains=youtube&pstMsg=1");

当我在cmd上执行curl命令时,它将返回:

[[["gf.alr",1,"AEThLlwlebb7W1RYlLuzzbjULcWu3FBI8h1rHbYtYYxSzkHth1uODsVtXXsMmmV67l4QIEcnpCbwktJKZNRzHHlfSfAWtsxOfGsCWdTY11DIXezT1go9QWvvzD10WHR-vObqEXddRZWY0LXmfOSLULmBo8jrlPaMs7TaiVXrYhQEbcudfhr5BTdpRyHv3JhlXCG6BTHh6_ia6-0pcxnn52FJAge6C0FPi3CBvJKqWGWF9zu0RTFTIQLqCGRB2g2cFhxMqgnw4JTI4FMkDjF3P6kQVE1G6m9b8ogZ6dZnRsRIqF4CEHpm2nDripxd9Kcndf2mmmSrL2K8nCp5MYvM2knpOcEcngOCaxKHOlMOZP4TfM1vnQQ2Qn3Yyx_OhcvsyxTmyfU8mpX3eE7HAUhcMPDVSTCoZp5mWLnFCMK32ejdmtVwWu_Pt89n44f-8h_DzCOI6ATXPz2QlBvYsXovdR6Lhnm3HEDevc5OvDuf-SMXjhto_ZH9cdKlBwa2gzEZ0WfnDblTr3Lin9zaBcZYN0Rp4rQoC4-cAJ6qZxpKjvV9r5ZrH9WpRPIrC--PiniCkEIp9i2p6ynMFMwDLBl0wrEno_MV4eGmWw",[["mkavraz52@gmail.com",null,null,null,null,"mkavraz52@gmail.com","gmail.com",null,null,2]
]
,null,null,null,["gf.sisr",1,null,null,[[[null,null,"type: FIRST_AUTH_FACTOR\n",1,null,"INITIALIZED",null,null,1,7,null,null,null,null,null,null,"mkavraz52@gmail.com","https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/APUIFaMFKElIS-cS2v6tDe_4y9Lj73VGkQ/mo/photo.jpg",null,null,1,1,{"1001":[1]
,"5001":[]
}]
]
,null,null,null,null,null,null,null,[null,[3]
,null,null,3]
,[null,null,null,null,5]
]
]
,null,null,null,null,null,null,"https://accounts.google.com/signin/recovery?continue\u003dhttps%3A%2F%2Fmail.google.com%2Fmail%2F\u0026service\u003dmail\u0026checkedDomains\u003dyoutube\u0026checkConnection\u003dyoutube%3A601%3A1\u0026pstMsg\u003d1\u0026flowName\u003dGlifWebSignIn\u0026Email\u003dmkavraz52%40gmail.com\u0026ignoreShadow\u003d0\u0026hl\u003dtr"]
,["gf.ttu",1]
,["e",3,null,null,1548]
]]

但是当我尝试使用RestSharp方法时,它将返回:

[[["gf.alr",7,"AEThLlyCDMIamKArdyiWksBe6yomPMceuC3NiVgNy_VE66b5hz6m8LdQH6VwB0LODrhbSb3QYzZ5oJkPR4UooBuMCC9iDkhTtL5ir3GeoY5-NyXhYeiypGz5egG_YAbP_j1bcPj9rTzC6zBxgZgqazZpv7XexoHM2wTD-TIrAftSP7s-RVoxPo_Og4xAxNEvnvlCnQ1Gw4wsURvopbPWKOiRYf-tgtV3Sw",[]
,null,null,null,null,null,null,null,null,0]
,["gf.ttu",1]
,["e",3,null,null,335]
]]

这些结果是不同的。我无法在RestSharp上获得真实的结果。我该怎么办?

0 个答案:

没有答案