I am currently working on an API that is designed to extract data from a specific website. The structure of the website looks like this - >
<div id="mainContainer">
<a class="item">text1</a>
<a class="item">text2</a>
<a class="item">text3</a>
<a class="item">text4</a>
<a class="item">text5</a>
</div>
My goal is to store all the text in an object format such as {"item1":"text1","item2":"text2"......}; Here is my current approach:
var prediction = $('#mainContainer > item');
console.log(prediction);
The output I receive is:
<a class="item">text1</a><a class="item">text2</a><a class="item">text3</a>....
I am seeking guidance on how to achieve this. Any suggestions?