Распарсить HTML страницу
2 |
0
18 ноября 2022 в 12:13:20
(2 года 5 дней 2 часа назад)
<div data-mandatory="" class="advq_question_container ">
<div class="advq_question_wrap">
<div class="advq_question" data-question-id="question-30">Этот знак означает:</div>
<div class="advq_question_image">
<figure>
<img data-original-width="650" data-original-height="200" src="https://russiantestdmv.com/wp-content/uploads/2021/03/dorojnie-znaki-ssha-038-650x200.jpg" srcset="https://russiantestdmv.com/wp-content/uploads/2021/03/dorojnie-znaki-ssha-038-650x200.jpg 650w, https://russiantestdmv.com/wp-content/uploads/2021/03/dorojnie-znaki-ssha-038-300x92.jpg 300w, https://russiantestdmv.com/wp-content/uploads/2021/03/dorojnie-znaki-ssha-038-1024x316.jpg 1024w, https://russiantestdmv.com/wp-content/uploads/2021/03/dorojnie-znaki-ssha-038-768x237.jpg 768w, https://russiantestdmv.com/wp-content/uploads/2021/03/dorojnie-znaki-ssha-038.jpg 1301w" alt="Question Image" title="dorojnie-znaki-ssha-038">
</figure>
</div>
<ul data-priority="normal" data-type="radio" data-relation="ignore" class="advq_question_list" data-question-id="question-30">
<li class="quiz_unselected_answer">
<input data-value=\\\\\\\\\\\\\\\'Переход запрещен\\\\\\\\\\\\\\\' data-rule=\\\\\\\\\\\\\\\'0\\\\\\\\\\\\\\\' id=\\\\\\\\\\\\\\\'question-30_0\\\\\\\\\\\\\\\' name=\\\\\\\\\\\\\\\'question-30\\\\\\\\\\\\\\\' type=\\\\\\\\\\\\\\\'radio\\\\\\\\\\\\\\\' data-points=\\\\\\\\\\\\\\\'1\\\\\\\\\\\\\\\'>
<label for=\\\\\\\\\\\\\\\'question-30_0\\\\\\\\\\\\\\\'>
<span class="advq_a_input">
<i class="fa fa-square-o" aria-hidden="true"></i>
</span>
Переход запрещен
</label>
</li>
<li class="quiz_unselected_answer">
<input data-value=\\\\\\\\\\\\\\\'Впереди школьная зона\\\\\\\\\\\\\\\' data-rule=\\\\\\\\\\\\\\\'0\\\\\\\\\\\\\\\' id=\\\\\\\\\\\\\\\'question-30_1\\\\\\\\\\\\\\\' name=\\\\\\\\\\\\\\\'question-30\\\\\\\\\\\\\\\' type=\\\\\\\\\\\\\\\'radio\\\\\\\\\\\\\\\' data-points=\\\\\\\\\\\\\\\'1\\\\\\\\\\\\\\\'>
<label for=\\\\\\\\\\\\\\\'question-30_1\\\\\\\\\\\\\\\'>
<span class="advq_a_input">
<i class="fa fa-square-o" aria-hidden="true"></i>
</span>
Впереди школьная зона
</label>
</li>
<li class="quiz_unselected_answer">
<input data-value=\\\\\\\\\\\\\\\'Впереди пешеходный переход\\\\\\\\\\\\\\\' data-rule=\\\\\\\\\\\\\\\'1\\\\\\\\\\\\\\\' id=\\\\\\\\\\\\\\\'question-30_2\\\\\\\\\\\\\\\' name=\\\\\\\\\\\\\\\'question-30\\\\\\\\\\\\\\\' type=\\\\\\\\\\\\\\\'radio\\\\\\\\\\\\\\\' data-points=\\\\\\\\\\\\\\\'1\\\\\\\\\\\\\\\'>
<label for=\\\\\\\\\\\\\\\'question-30_2\\\\\\\\\\\\\\\'>
<span class="advq_a_input">
<i class="fa fa-square-o" aria-hidden="true"></i>
</span>
Впереди пешеходный переход
</label>
</li>
<li class="quiz_unselected_answer">
<input data-value=\\\\\\\\\\\\\\\'Рабочие на проезжей части\\\\\\\\\\\\\\\' data-rule=\\\\\\\\\\\\\\\'0\\\\\\\\\\\\\\\' id=\\\\\\\\\\\\\\\'question-30_3\\\\\\\\\\\\\\\' name=\\\\\\\\\\\\\\\'question-30\\\\\\\\\\\\\\\' type=\\\\\\\\\\\\\\\'radio\\\\\\\\\\\\\\\' data-points=\\\\\\\\\\\\\\\'1\\\\\\\\\\\\\\\'>
<label for=\\\\\\\\\\\\\\\'question-30_3\\\\\\\\\\\\\\\'>
<span class="advq_a_input">
<i class="fa fa-square-o" aria-hidden="true"></i>
</span>
Рабочие на проезжей части
</label>
</li>
</ul>
</div>
</div>
В примере кусок текста с сайта.
Реальный файл со всей остальной начинкой.
Нужно распарсить, выбрать блоки с вопросами и на основе них заполнить ТЗ на форме в виде дерева.
уровень1: Вопрос(текст, ссылка на изображение)
уровень2: Ответы(текст ответа, ответ верный(булево), ссылка на изображение)
Завершена (18.11.2022)