VR Search

Written by debjoy, on October 27, 2019, last modified on October 27, 2019





Virutal Reality, is something many of us has not experienced in our lives, going to a completely immersive virtual world, cutting of from reality and all. I personally have been fascinated with this technology for a long time and working with VR would be awesome.

I wanted to start some kind of work with VR so I researched for ways and platfoms to achieve that. There are three broad categories of VR, PC games/ software VR, Mobile app/ game VR and Web VR. As I was working on web development since one year I went for Web VR. I picked up a frameowork called Aframe.js as my starting point and started learning from their interactive website. After that I started of with a project.

The project I panned is to create a web search interface in VR. Started of with the design with a search box, gave a 360 degree background image to set a 3D perpective, created a keyboard with individual characters as button ( looks as if the keyboard is floating). Button to delete and button to start search.

I started searching for search web APIs, but couldn’t find any free versions of any. Could have used google’s search to get result in background and decode the html to get the resutls but that will be illegal and stopped by CORS. You can read more about CORS here.

http://gigablast.com/api

Atlast I found a website called gigablast.com where you can apparently use the sevices freely but there’s a catch. When you do GET request with browser you will see a loading animation before the page actually shows results. (see here) So when I did AJAX reques it only captured the intermediate result.

The Intermediate Result

I viewed the page source of that intermediate result. I saw that this page was itself doing another GET request with extra fields containing random numbers. When I copied the modified query with the random number in that, it fetched the results directly. So I modified my query in my GET request and it worked flaulessly FOR ONE DAY. The following day the random number changed. Also the format of results in JSON format was incorrect.

The Extra Parameters

I created two AJAX request chained to one another. The first one does a normal request to get the intermediate page, then decoded with intermediate page’s html resutls (using combination of substring, indexOf, length, etc) to get the random values which are to be concatenated with the query. The following AJAX function takes the final query, executes it, gets the correct results, decodes it and gets the resultant data.

After getting the results the results are shown to user all around him/her in a “Virtual World”. The top results are in front and the lower results in the back. There is a back button to reset the VR Search. I wanted to do a lot more than just get results and displaying as text but in Web VR the development is a bit limited. Maybe later I would be able to, so I started learning Unity VR. Till then, this project is open source for anyone to work on that. As usual, I hope this article will help someone, and thank you for visiting.


|

Leave a Reply

Your email address will not be published. Required fields are marked *