Пост(Post) запрос вытянуть данные



  • Есть вот такой ответ на пост запрос как из него(вот из этой части <span class="badge" style="background: green">0</span>) вытянуть ноль?

    {"out":"","error":"","table":"<div style=\"padding: 10px 0px\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f 30 \u0434\u043d\u0435\u0439):<br><a href=\"\/dnsbl\/7f52c38957b3f619420e6550c903fb74\" target=\"_blank\">https:\/\/www.syslab.ru\/dnsbl\/7f52c38957b3f619420e6550c903fb74<\/a><\/div>195.246.54.66:53281 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d. \u041d\u0430\u0439\u0434\u0435\u043d \u0432 \u0447\u0451\u0440\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u0430\u0445:  <span class=\"badge\" style=\"background: green\">0<\/span> \u0438\u0437 33<br><br><table class=\"table table-striped table-hover\"><tr class=\"text-success\"><td>zen.spamhaus.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.spamhaus.org\/zen\/\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dul.dnsbl.sorbs.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.sorbs.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>pbl.spamhaus.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.spamhaus.org\/pbl\/\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>proxy.bl.gweep.ca<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>virus.rbl.jp<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>virbl.bit.nl<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>bl.emailbasura.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.emailbasura.org\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>orvedb.aupads.org<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>korea.services.net<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dynip.rothen.com<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>ubl.unsubscore.com<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.lashback.com\/support\/UnsubscribeBlacklistSupport.aspx\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>duinv.aupads.org<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dnsbl.anticaptcha.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/anticaptcha.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>phishing.rbl.msrbl.net<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>noptr.spamrats.com<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.spamrats.com\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>ix.dnsbl.manitu.net<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>http.dnsbl.sorbs.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.sorbs.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>cbl.abuseat.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/cbl.abuseat.org\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>blackholes.five-ten-sg.com<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.five-ten-sg.com\/blackhole.php\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>bogons.cymru.com<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dyna.spamrats.com<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.spamrats.com\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>drone.abuse.ch<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/drone.abuse.ch\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dnsbl.inps.de<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dnsbl-3.uceprotect.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.uceprotect.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>db.wpbl.info<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.wpbl.info\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>cdl.anti-spam.org.cn<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>blacklist.woody.ch<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/blacklist.woody.ch\/rblcheck.php3\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>bl.spamcannibal.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/www.spamcannibal.org\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>all.s5h.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/all.s5h.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>bl.spamcop.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/bl.spamcop.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>dnsbl.sorbs.net<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/dnsbl.sorbs.net\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>b.barracudacentral.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/b.barracudacentral.org\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><tr class=\"text-success\"><td>zen.spamhaus.org<\/td><td width=\"30\" align=\"center\"><a href=\"http:\/\/zen.spamhaus.org\" target=\"_blank\" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u043b\u044d\u043a \u043b\u0438\u0441\u0442\u0430\"><span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"><\/span><\/a><\/td><td width=\"30\" align=\"center\">-<\/td><td width=\"30\" align=\"right\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\" style=\"color:green\"><\/span><\/td><\/tr><\/table>"}
    


  • @assd said in Пост(Post) запрос вытянуть данные:

    Есть вот такой ответ на пост запрос как из него(вот из этой части <span class="badge" style="background: green">0</span>) вытянуть ноль?

    {"out":"","error":"","table":"<div style="padding: 10px 0px">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f 30 \u0434\u043d\u0435\u0439):<br><a href="/dnsbl/ce1f872aa39fe66b8e772b7ece11045c" target="_blank">https://www.syslab.ru/dnsbl/ce1f872aa39fe66b8e772b7ece11045c</a></div>195.246.54.66:53281 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d. \u041d\u0430\u0439\u0434\u0435\u043d \u0432 \u0447\u0451\u0440\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u0430\u0445:
    <span class="badge" style="background: green">0</span>
    \u0438\u0437 33<br><br><table class="table table-striped table-hover"><tr class="text-success"><td>zen.spamhaus.org</td><td width="30" align="center"><a href="http://www.spamhaus.org/........

    Ваш ответ приходит скорее всего в формате json, и вытащить его проще через JSON.parse(), но так как вы выложили не весь код ответа могу предложить регулярку:

    green">(.*?)<\/span>
    

    Да и для выкладывания кода есть кнопка
    0_1559290440678_87298694-a989-4cb9-898d-60df55997354-изображение.png
    чтобы не захламлять сообщение текстом кода и чтобы форум не съел часть символов форматированием.



  • @fox Я отредактировал пост,можете посмотреть как вытянуть с помощью JSON.parse()?



  • @assd said in Пост(Post) запрос вытянуть данные:

    @fox Я отредактировал пост,можете посмотреть как вытянуть с помощью JSON.parse()?

    В свойстве объекта table находится html код страницы, необходимый элемент достаётся через xpath

    //span[@class="badge"]
    

    0_1559292546138_1c6cd72a-fee9-4e15-a7fa-43250b086446-изображение.png

    Вот тестовый скрипт



  • @assd

    проверен. Найден в чёрных списках: 
    

    Все равно регулярка. ключ table а это все. Извините что влез
    0_1559292676318_2019-05-31_125040.png


Log in to reply
 

  • 2
  • 11
  • 3
  • 2
  • 6
  • 1
  • 4
  • 3