Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi everyone,

I'm building a project in which the user will fill in my website the search keyword and I will check in hundreds of websites if there is a result on the fetched websites.

my problem is that some websites that not have an API will not return 404 when there are no results and the response will look like 200 ok but there will not be any results.

I will be really glad to learn what is the best way to do it.

Thanks!

What I have tried:

Hi everyone,

I'm building a project in which the user will fill in my website the search keyword and I will check in hundreds of websites if there is a result on the fetched websites.

my problem is that some websites that not have an API will not return 404 when there are no results and the response will look like 200 ok but there will not be any results.

I will be really glad to learn what is the best way to do it.

Thanks!
Posted
Updated 4-Oct-20 23:04pm

1 solution

You'll have to analyse the response you do get back on a per-site basis to check for "No results found" or whatever that site does to indicate no results. Also a site shouldn't return 404 if there are no search results as the 404 indicates the URI you requested couldn't be found and a search result page that shows results still exists.
 
Share this answer
 
Comments
Learning Learning 5-Oct-20 5:07am    
thanks! so I will need to scrape every website?

P.S - the 404 refers to an API's where there a 404 when no results.
Dave Kreskowiak 5-Oct-20 10:48am    
That depends on each site. 404 means the requested URL couldn't be found, not that there are no search results.

There is a different between calling a Web API and a web page URL, like www.google.com. If it's a normal web page, yes, you'll have to write scrapper code for each and every one of your "hundreds" of sites. Hell, you'd have to do it for each and every site that's an API too! Good luck with that!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900