首先,有很多与此问题类似的问题,但是没有一个问题解决了我的问题。
Windows 10 x64 节点12.6.0 要求2.88.0 邮递员7.2.2
邮递员具有为npm请求生成代码的功能。
邮递员工作正常并返回数据。在代码中,该帖子起作用,并且正文返回api信息,但没有数据。
这是我正在使用的代码
var request = require("request");
var options = { method: 'POST',
url: 'https://www.netflix.com/api/shakti/v73fa49e3/pathEvaluator',
qs:
{ drmSystem: 'widevine',
isWatchlistEnabled: 'false',
isVolatileBillboardsEnabled: 'true',
falcor_server: '0.1.0',
withSize: 'true',
materialize: 'true' },
headers:
{ 'cache-control': 'no-cache',
'Content-Length': '754',
Host: 'www.netflix.com',
'Cache-Control': 'no-cache',
'X-Netflix.browserName': 'Chrome',
'X-Netflix.osVersion': '10.0',
'X-Netflix.playerThroughput': '58194',
Referer: 'https://www.netflix.com/browse/my-list',
Accept: '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36',
'X-Netflix.esnPrefix': 'NFCDCH-02-',
'X-Netflix.uiVersion': 'v73fa49e3',
'X-Netflix.browserVersion': '75',
Connection: 'keep-alive',
'X-Netflix.clientType': 'akira',
'Accept-Language': 'en-US,en;q=0.9,es;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
DNT: '1',
'X-Netflix.osFullName': 'Windows 10',
Origin: 'https://www.netflix.com' },
form:
{ path:
[ '["mylist",["id","length","name","requestId","trackIds"]]',
'["mylist",{"from":0,"to":400},["availability","availabilityEndDateNear","delivery","interactiveBookmark","maturity","numSeasonsLabel","queue","releaseYear","runtime","seasonCount","summary","title","userRating","userRatingRequestId"]]',
'["mylist",{"from":0,"to":400},"current",["hasAudioDescription","summary"]]',
'["mylist",{"from":0,"to":400},"boxarts","_233x131","webp"]' ],
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
答案 0 :(得分:2)
这可能会对您有所帮助。
const request = require("request");
// URL
const reqUrl = 'https://www.netflix.com/api/shakti/v73fa49e3/pathEvaluator';
// HEADERS
const reqHeaders = {
'cache-control': 'no-cache',
'Content-Length': '754',
Host: 'www.netflix.com',
'Postman-Token': '845e51a3-67cf-4d93-8518-997a7e22f4b7,edf531a3-056c-493e-86b4-3003504214ff',
'Cache-Control': 'no-cache',
'X-Netflix.browserName': 'Chrome',
'X-Netflix.osVersion': '10.0',
'X-Netflix.playerThroughput': '58194',
Referer: 'https://www.netflix.com/browse/my-list',
Accept: '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36',
'X-Netflix.esnPrefix': 'NFCDCH-02-',
'X-Netflix.uiVersion': 'v73fa49e3',
'X-Netflix.browserVersion': '75',
Connection: 'keep-alive',
Cookie: 'memclid=0abfdde3-fdf8-4e6e-acc5-dae57e09941d; clSharedContext=7461c7cc-5a56-4e5f-b733-6febb8acd74e; lhpuuidh-browse-JGKS7R3LLZAC5M5AEZ5UK2FYIQ=US%3AEN-US%3A5f656cb6-ec81-4ffe-84b1-63a759e1f49b_ROOT; lhpuuidh-browse-JGKS7R3LLZAC5M5AEZ5UK2FYIQ-T=1562281011685; lhpuuidh-browse-vvvvvrrerr=US%3AEN-US%3Abdfaa1e1-6464-4f31-bd4e-1c3e1c1d8a39_ROOT; lhpuuidh-browse-SN75QUHUXBHIAR23$TOJ3MZFVNQ7VYM-T=1562281110358; flwssn=8acee0b3-44c5-47ca-83ca-d6df6812aae6; profilesNewSession=0; NetflixId=v%3D2%26c$t3DBQAOAAEBEG4pPrNrBZszdxk8h2J8z1-BwG9mHUGvDRv7ORSv67vAlP-SdTbWM7Nx0lORLEed8a5yNR37Ws-WNM9SGe27SaTdJVqavU0oXha4WaZ0BWfDqu_6jQVvSXK0448K3QbpZ_QdubFfWu0h0SFXFxvXYR5cS-ks0bg7SF4V8iLC15QA-Lr7f354xZWDdAWV1xEYPVT06ptRRqi7g1cLE778U9WP9LCJYARWmuFPlxGVe4cmwxhQRGShu5IN6ucYcSe4OEJL-Ew1Yxd5mk4_0fhzkf05QAnirTzm5BpP7h07p06D3ZOdOzGsBlI-fV51g9eXvlA1kTL7irOJ6nq6NaXz1L397kEjcEvpgcCS5pslq3a9qEQ60KOathphl5GLZGxn4xvXIcx5Hm8cfs4iVng1kn9elzavpq9AbE8ce9pbbS82IF16MlOcVwICJXB9z_TNZ9ejkmMtACl8mKmJoXBZIRYZJXCbE0wcj-R4WQKZDqQJvWsPb_3a0PQBGoZojZ8pbdM3LUf21uxPBbFa8xmikLTMUM6FMbrMhpNqJ9tiQ5X2eAqtaeRHb3f7Dooz-E04hw9Or5_UaeX9264Rc6xtHpjDDfgg57LCza3BohNv3ag14Es.%26bt%3Ddbl%26ch%3DAQEAEAABABTq8jfw7-uqTNfPp2rJYz9aGgfupIDvmNU.%26mac%3DAQEAEAABABTp8m22vbAq4UFdbkSZ8fwNXxu5lA2rUaQ.; SecureNetflixId=v%3D2%26mac%3DAQEAEQABABRFqE_Sb9qJah1InM9FBWZTOIDUlQqiX8s.%26dt%3D1562307985579; nfvdid=BQFmAAEBEBhpAs5prG2e%2FuSxGlzoowlgHvZPo5LP%2F2%2BADgwBZrcGgdZwsfNb0vdVGKri8rGJwZ8gD9CRQs66NlMtqB3G%2FZYyTtnkl9qZoWp9AUfIhhmJPVbVTcsWX9j3ohgTuunD58WRtFBLFwu4HRlh2f70lszp; playerPerfMetrics=%7B%22uiValue%22%3A%7B%22throughput%22%3A59173%7D%2C%22mostRecentValue%22%3A%7B%22throughput%22%3A59173%7D%7D; cL=1562307988270%7C156230796458086017%7C156230796487562712%7C%7C8%7CTR7OX5P3Z5DY3DVRBZH7CZQVDI,memclid=0abfdde3-fdf8-4e6e-acc5-dae57e09941d; clSharedContext=7461c7cc-5a56-4e5f-b733-6febb8acd74e; lhpuuidh-browse-JGKS7R3LLZAC5M5AEZ5UK2FYIQ=US%3AEN-US%3A5f656cb6-ec81-4ffe-84b1-63a759e1f49b_ROOT; lhpuuidh-browse-JGKS7R3LLZAC5M5AEZ5UK2FYIQ-T=1562281011685; lhpuuidh-browse-SN75QUHUXBHITOJ3MZFVNQ7VYM=US%3AEN-US%3Abdfaa1e1-6464-4f31-bd4e-1c3e1c1d8a39_ROOT; lhpuuidh-browse-SN75QUHUXBHITOJ3MZFVNQ7VYM-T=1562281110358; flwssn=8acee0b3-44c5-47ca-83ca-d6df6812aae6; profilesNewSession=0; NetflixId=v%3D2%26ct%3DBQAOAAEBEG4pPrNrBZszdxk8h2J8z1-BwG9mHUGvDRv7ORSv67vAlP-SdTbWM7Nx0lORLEed8a5yNR37Ws-WNM9SGe27SaTdJVqavU0oXha4WaZ0BWfDqu_6jQVvSXK0448K3QbpZ_QdubFfWu0h0SFXFxvXYR5cS-ks0bg7SF4V8iLC15QA-Lr7f354xZWDdAWV1xEYPVT06ptRRqi7g1cLE778U9WP9LCJYARWmuFPlxGVe4cmwxhQRGShu5IN6ucYcSe4OEJL-Ew1Yxd5mk4_0fhzkf05QAnirTzm5BpP7h07p06D3ZOdOzGsBlI-fV51g9eXvlA1kTL7irOJ6nq6NaXz1L397kEjcEvpgcCS5pslq3a9qEQ60KOathphl5GLZGxn4xvXIcx5Hm8cfs4iVng1kn9elzavpq9AbE8ce9pbbS82IF16MlOcVwICJXB9z_TNZ9ejkmMtACl8mKmJoXBZIRYZJXCbE0wcj-R4WQKZDqQJvWsPb_3a0PQBGoZojZ8pbdM3LUf21uxPBbFa8xmikLTMUM6FMbrMhpNqJ9tiQ5X2eAqtaeRHb3f7Dooz-E04hw9Or5_UaeX9264Rc6xtHpjDDfgg57LCza3BohNv3ag14Es.%26bt%3Ddbl%26ch%3DAQEAEAABABTq8jfw7-uqTNfPp2rJYz9aGgfupIDvmNU.%26mac%3DAQEAEAABABTp8m22vbAq4UFdbkSZ8fwNXxu5lA2rUaQ.; SecureNetflixId=v%3D2%26mac%3DAQEAEQABABRFqE_Sb9qJah1InM9FBWZTOIDUlQqiX8s.%26dt%3D1562307985579; nfvdid=BQFmAAEBEBhpAs5prG2e%2FuSxGlzoowlgHvZPo5LP%2F2%2BADgwBZrcGgdZwsfNb0vdVGKri8rGJwZ8gD9CRQs66NlMtqB3G%2FZYyTtnkl9qZoWp9AUfIhhmJPVbVTcsWX9j3ohgTuunD58WRtFBLFwu4HRlh2f70lszp; playerPerfMetrics=%7B%22uiValue%22%3A%7B%22throughput%22%3A59173%7D%2C%22mostRecentValue%22%3A%7B%22throughput%22%3A59173%7D%7D; cL=1562307988270%7C156230796458086017%7C156230796487562712%7C%7C8%7CTR7OX5P3Z5DY3DVRBZH7CZQVDI; memclid=0abfdde3-fdf8-4e6e-acc5-dae57e09941d; SecureNetflixId=v%3D2%26mac%3DAQEAEQABABSBtymZf_WUUxqlLjxi9Tcz1N9HfVu27lk.%26dt%3D1562373989602; NetflixId=ct%3DBQAOAAEBENa9KbSSXAiVkZ-nyrCx-eqB4E5bZ_0MPQueZB7vgCnv5dv90cB7Lw9mzIa4SiUj09G9TjdSTfh56B6WIBR0QhsgE99T2rPoDs0iKPhegsCl20lLNc8LFYmhH1duOYA09lPXxaW7fjFea3v7KdbVhEkoCQKMJ5XM4G6vuMmMMUWGnqftt8Fa7xGmgxsrZBYxLhyqA_EC0YKIIlXeNC2kzcc7igTTU1LPIgQmvq-eOkskaCnkfX995ZzIj1yrcXa6xEIprO7E2buzF0nnDcqiiLwDwWNOF_DNCiyHxT9SbBTeaacoAHVI4iXnZ3HY4GVHJuq7gJEtGR8fwraPVyCIc5jeiFu1FXdKogro5w22TrQNNQU-eDBEBoLImmk1pZqBwbSYVrsk86JkqGtWmuxFGyyBTmTSyrfhcETUDOSPvveWCaiBA617rqOTP7n8UbfBnWDCoDS1FCweAGM1K_7JVOY3f7Bo6CVUvLODKutGsuXar9GiOmPoCJMiCO-MCnda3BS-oqROhm5nOEL5rCWRlxlIgn8vrQB5ELWADX3qwwSEi7yTZ-hHaQSI5xIkqFcgeH0LT27fpxdrz01jlZ2o1glDQhBKoO34WTmllvCDQzqcBL7_nNaE4Y9I30N00O18pBXIgHYloRDnOUUxV66_9AxBiw..%26bt%3Ddbl%26ch%3DAQEAEAABABTq8jfw7-uqTNfPp2rJYz9aGgfupIDvmNU.%26v%3D2%26mac%3DAQEAEAABABQmYnZZPVCzzqbysYph9oT_ddbBqaBhqLM.',
'X-Netflix.osName': 'Windows',
'x-netflix.request.client.user.guid': 'JGKS7R3LLZAC5M5AEZ5UK2FYIQ',
'X-Netflix.clientType': 'akira',
'Accept-Language': 'en-US,en;q=0.9,es;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
DNT: '1',
'X-Netflix.osFullName': 'Windows 10',
Origin: 'https://www.netflix.com'
};
// QUERY PARAMS
const queryParams = {
drmSystem: 'widevine',
isWatchlistEnabled: 'false',
isVolatileBillboardsEnabled: 'true',
falcor_server: '0.1.0',
withSize: 'true',
materialize: 'true',
};
// REQ BODY
const reqBody = {
path:
['["mylist",["id","length","name","requestId","trackIds"]]',
'["mylist",{"from":0,"to":400},["availability","availabilityEndDateNear","delivery","interactiveBookmark","maturity","numSeasonsLabel","queue","releaseYear","runtime","seasonCount","summary","title","userRating","userRatingRequestId"]]',
'["mylist",{"from":0,"to":400},"current",["hasAudioDescription","summary"]]',
'["mylist",{"from":0,"to":400},"boxarts","_233x131","webp"]'],
authURL: '1562307985945.HbhvPp8+bh2fI7XfVLhH3Dj6zJc='
}
// OPTIONS
const options = {
method: 'POST',
url: reqUrl,
headers: reqHeaders,
qs: queryParams,
body: qs.stringify(reqBody),
json: true,
};
request(options, (error, response, resBody) => {
if (error) {
throw error;
} else if (response.statusCode !== 200) {
throw resBody;
}
return resBody;
});
答案 1 :(得分:1)
我发现了问题所在。 api期望数据在字符串中的主体查询字符串中。
为此,请从请求中删除form变量。然后对form变量的值进行字符串化,然后将其作为正文发送出去
工作代码:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="gallery_show_ekpresi"></div>