• Najnowsze pytania
  • Bez odpowiedzi
  • Zadaj pytanie
  • Kategorie
  • Tagi
  • Zdobyte punkty
  • Ekipa ninja
  • IRC
  • FAQ
  • Regulamin
  • Książki warte uwagi

wypis z node-fetch różni się od html-a strony

Cloud VPS
0 głosów
283 wizyt
pytanie zadane 16 września 2021 w JavaScript przez Maxxxii Obywatel (1,310 p.)

Cześć, mam problem, że pobieram informacje ze strony za pomocą node fetch lecz to co mi się wyświetla jest inne niż html który sam sprawdzę na stronie. Tak jakby nie zczytywał całego html-a ze strony.

To informacje z fetch-a:

text: <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"/><title>Which runway to choose? The best runway suggestion based on wind</title><meta name="title" content="Which runway to choose? The best runway suggestion based on wind"/><meta name="description" content="Easy way to find the best runway for takeoff or land. Enter airport ICAO code and get runways suggestions based on wind data."/><meta property="og:type" content="website"/><meta property="og:url" content="https://runway.airportdb.io/"/><meta property="og:title" content="Which runway to choose? The best runway suggestion based on wind"/><meta property="og:description" content="Easy way to find the best runway for takeoff or land. Enter airport ICAO code and get runways suggestions based on wind data."/><meta property="og:image" content="https://runway.airportdb.io/social.png"/><meta property="twitter:card" content="summary_large_image"/><meta property="twitter:url" content="https://runway.airportdb.io/"/><meta property="twitter:title" content="Which runway to choose? The best runway suggestion based on wind"/><meta property="twitter:description" content="Easy way to find the best runway for takeoff or land. Enter airport ICAO code and get runways suggestions based on wind data."/><meta property="twitter:image" content="https://runway.airportdb.io/social.png"/><link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"/><link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"/><link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"/><link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"/><link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"/><link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"/><link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"/><link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><meta name="msapplication-TileColor" content="#000000"/><meta name="msapplication-TileImage" content="/ms-icon-144x144.png"/><meta name="theme-color" content="#000000"/><link href="/static/css/main.fea10a06.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,p=r[0],l=r[1],f=r[2],c=0,s=[];c<p.length;c++)a=p[c],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,p=1;p<t.length;p++){var l=t[p];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/";var p=this["webpackJsonprunway-app"]=this["webpackJsonprunway-app"]||[],l=p.push.bind(p);p.push=r,p=p.slice();for(var f=0;f<p.length;f++)r(p[f]);var i=l;t()}([])</script><script src="/static/js/2.6ca13abe.chunk.js"></script><script src="/static/js/main.1e98383a.chunk.js"></script></body></html>
result: <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"/><title>Which runway to choose? The best runway suggestion based on wind</title><meta name="title" content="Which runway to choose? The best runway suggestion based on wind"/><meta name="description" content="Easy way to find the best runway for takeoff or land. Enter airport ICAO code and get runways suggestions based on wind data."/><meta property="og:type" content="website"/><meta property="og:url" content="https://runway.airportdb.io/"/><meta property="og:title" content="Which runway to choose? The 
best runway suggestion based on wind"/><meta property="og:description" content="Easy way to find the best runway for takeoff or land. Enter airport ICAO code and get runways suggestions based on wind data."/><meta property="og:image" content="https://runway.airportdb.io/social.png"/><meta property="twitter:card" content="summary_large_image"/><meta property="twitter:url" content="https://runway.airportdb.io/"/><meta property="twitter:title" content="Which runway to choose? The best runway suggestion based on wind"/><meta property="twitter:description" content="Easy way to find the best runway for takeoff or land. Enter airport ICAO code and get runways suggestions based on wind data."/><meta property="twitter:image" content="https://runway.airportdb.io/social.png"/><link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"/><link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"/><link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"/><link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"/><link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"/><link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"/><link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"/><link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><meta name="msapplication-TileColor" content="#000000"/><meta name="msapplication-TileImage" content="/ms-icon-144x144.png"/><meta name="theme-color" content="#000000"/><link href="/static/css/main.fea10a06.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,p=r[0],l=r[1],f=r[2],c=0,s=[];c<p.length;c++)a=p[c],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,p=1;p<t.length;p++){var l=t[p];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/";var p=this["webpackJsonprunway-app"]=this["webpackJsonprunway-app"]||[],l=p.push.bind(p);p.push=r,p=p.slice();for(var f=0;f<p.length;f++)r(p[f]);var i=l;t()}([])</script><script src="/static/js/2.6ca13abe.chunk.js"></script><script src="/static/js/main.1e98383a.chunk.js"></script></body></html>

A to co jest na stronie:

 

1 odpowiedź

+1 głos
odpowiedź 16 września 2021 przez Ehlert Ekspert (215,050 p.)

Spróbuj w dev-toolsach prawym kliknąć na request w zakładce Network i wybrać opcję copy as fetch. Żeby otrzymać tą samą odpowiedź powinieneś wysłać jak najbardziej zbliżone żądanie: te same nagłówki itp itd. 

Niestety nie jest powiedziane że serwer musi odpowiedzieć w dokładnie ten sam sposób.

komentarz 16 września 2021 przez ScriptyChris Mędrzec (190,190 p.)

Niestety nie jest powiedziane że serwer musi odpowiedzieć w dokładnie ten sam sposób.

Z ciekawości, dlaczego przy dwóch takich samych requestach (pomijając wpływ ewentualnej sesji, różnicy w czasie i geolokalizacji) serwer miałby odpowiedzieć inaczej? 

komentarz 17 września 2021 przez Ehlert Ekspert (215,050 p.)
Request get raczej powinien być taki sam, jeśli nie przekroczysz limitu.

Ale ogólnie to co system zwraca jest mega niedeterministyczne. Procesowanie danych w tle, upływający czas itp. Jest bardzo dużo czynników.

Podobne pytania

0 głosów
2 odpowiedzi 766 wizyt
pytanie zadane 6 września 2021 w JavaScript przez Maxxxii Obywatel (1,310 p.)
+1 głos
1 odpowiedź 1,327 wizyt
pytanie zadane 18 września 2021 w JavaScript przez Maxxxii Obywatel (1,310 p.)
0 głosów
1 odpowiedź 1,035 wizyt
pytanie zadane 23 lipca 2020 w JavaScript przez Samek2222 Początkujący (440 p.)

93,468 zapytań

142,404 odpowiedzi

322,706 komentarzy

62,849 pasjonatów

Motyw:

Akcja Pajacyk

Pajacyk od wielu lat dożywia dzieci. Pomóż klikając w zielony brzuszek na stronie. Dziękujemy! ♡

Oto polecana książka warta uwagi.
Pełną listę książek znajdziesz tutaj

Kursy INF.02 i INF.03
...