Home > other >  Getting data from html string and push to array
Getting data from html string and push to array

Time:12-08

So i'm making a post request and the response is a string of html and i'm trying to get the data from the "dropUser" part of the html string but i'm having a little trouble and was hoping maybe someone could help me or point me in the right direction.

My goal is to get the data from the "dropUser" html string and push them to an array.

For an example the ID 4289985, and username 'MeowCat i want to get all of them and push to an array.

let str = `<div id="container_user">
  <div >
    <div >
      Online <span >4</span>
    </div>
  </div>
  <div >
    <div onclick="dropUser(this,5,'ChatAveBot',1,1,'ZZ','','0','');" >
      <div ><img  src="/avatar/default_avatar.png" /> </div>
      <div >
        <p >ChatAveBot</p>
      </div>
      <div ><img src="default_images/rank/bot.svg"  title="Bot" /></div>
    </div>
    <div onclick="dropUser(this,3754679,'Fantastic',1,0,'ZZ','','14','');" >
      <div ><img  src="/avatar/avatar_user3754679_1638955491.jpg" /> </div>
      <div >
        <p >Fantastic</p>
        <p >TheDD7デイビスになる =           
  • Related