question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interval between connection and fetch

See original GitHub issue

Hello, I am trying to fetch html from a PHP website but the website show a “Querying Server Data…” text during 0.5s before showing the informations I want to fetch So I need to put an interval delay between “connection” and fetching data from the website

How can I do this ?

Example Code

fetch("https://games.ludosoft.net/sourcebans/index.php", {delay: 500})
	.then((res) => res.text())
	.then((body) => {
		...
	});

Expected behavior, if applicable

The fetch() call will return the data delay (500 here) ms after accessing the website to give him time to load correct data

Your Environment

software version
node-fetch 2.6.1
node 14.15.3
npm 6.14.9
Operating System Windows 10 Family, 20H2, x64

Additional context/Screenshots

Here is a GIF of what happen when loading the page Querying Server Data gif

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
jimmywartingcommented, Jun 9, 2021

I don’t know. this is beyond our scope. Better ask this kind of question on Stackoverflow one alternative is to use a headless browser that renders the website with javascript. but that is more tech heavy.

you would need some xml parser

0reactions
KGrisscommented, Jun 9, 2021

Thank you very much !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using set interval and fetch in a function - Stack Overflow
I made the function and the fetch works, but i don't know how to set interval in the same function, without having to...
Read more >
How to Timeout a fetch() Request - Dmitri Pavlutin
By default a fetch() request timeouts at the time setup by the browser. In Chrome, for example, this setting equals 300 seconds. That's...
Read more >
SQL BETWEEN Command to fetch records from a range
Query using different time along with date like records between 9 to 18 hours of a particular date , all records with time...
Read more >
Pool Should Have Option to Always Validate on Fetch - General
Since the Pool is created with the default settings, there will always be at least 1 connection in the pool, with a validationInterval...
Read more >
MySQL Connection Handling and Scaling
In this post we describe MySQL connections, user threads, and scaling. We hope that an increased understanding of how MySQL works will help ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found