Как можно из сайта (не локального) собрать только JSON. На странице есть и HTML и JavaScripts в которых лежит JSON. Как его собрать со страницы и распарсить? Регулярными выражениями не весь JSON собирается.
Примечание:
Вот этот код я могу вытащить
{"category":3518,"category2":8,"id":9914,"level":66,"money":35000,"name":"A Head Full of Ivory","reprewards":[[933,250]],"reqlevel":64,"side":3,"wflags":128,"xp":11300}
Примечание:
А вот этот нет... А точнее его json_decode не понимает
{parent: 'fweiuasf', objectives: {
3518: {zone: 'Nagrand', mappable: 1, levels: {0: [{ type: '1', point: 'start', name: 'Shadrek', coord: [31.6,56.8], coords: [[31.6,56.8]], id: 18333, reactalliance: 1, reacthorde: 1},{ type: '1', point: 'end', name: 'Shadrek', coord: [31.6,56.8], coords: [[31.6,56.8]], id: 18333, reactalliance: 1, reacthorde: 1},{ type: '1', point: 'sourcerequirement', name: 'Wild Elekk', coord: [69.6,46.2], coords: [[25.2,54.8],[25.4,54.2],[25.6,53.8],[26.2,52.4],[26.2,52.6],[26.4,34.4],[26.4,50.6],[27.2,34.4],[27.2,34.6],[29.2,61.4],[29.4,61.6],[29.6,62.4],[29.8,63.4],[29.8,63.8],[30.4,64.8],[30.8,64.4],[31,64.6],[32.6,77.4],[33,29.2],[33,29.6],[33.2,28.4],[33.2,31.2],[33.6,78],[34.2,59.6],[34.4,59.4],[34.6,59.6],[35,78.4],[35.2,59.2],[35.2,78.6],[35.6,79.4],[35.8,59],[36,79.6],[36.6,59.4],[36.6,60],[36.6,60.6],[37,22.8],[38.4,58.8],[38.6,24.4],[38.6,59],[39.6,59.4],[40,54],[40,60],[40.6,54.4],[40.6,60.6],[40.8,54.6],[41,55.6],[41.2,60.2],[43,27.4],[43,27.6],[43,77],[43.2,76.4],[43.6,27.2],[44,76.2],[44.2,57.4],[44.4,26.4],[44.6,26.2],[44.6,76],[45.2,58.2],[45.4,75.2],[45.6,58.6],[46.2,27],[46.8,27],[46.8,75.2],[47,71.4],[47,72.4],[47,73.8],[47.2,70.4],[47.2,73.4],[47.8,70.2],[48.4,39.2],[48.4,39.6],[49,29.4],[49,64.2],[49.2,61.6],[49.4,30.2],[49.4,38.6],[49.4,61.4],[49.4,62.6],[49.6,30.4],[49.6,38.6],[49.6,63.2],[49.8,30.6],[49.8,61],[50,38.4],[50.4,60.4],[50.8,39.4],[51.2,30.8],[51.2,40],[51.2,60],[51.8,30.8],[51.8,60],[54.2,46.4],[54.4,46.8],[54.6,46.6],[55,45.8],[55.4,45.2],[55.8,44.8],[56.2,44],[56.6,43.8],[57.2,43.4],[57.6,47.2],[58,46.4],[58,57.8],[58.2,59],[58.2,59.8],[58.2,62],[58.4,67.4],[59,45.6],[59,66.8],[59.2,45.4],[59.2,66.2],[59.4,41.4],[59.4,41.8],[59.6,42],[59.6,44.6],[59.8,43.2],[59.8,43.8],[60,64.8],[60.4,39.2],[60.6,39],[61.2,39.6],[61.4,61.6],[61.6,39.8],[61.8,35],[62,45.4],[62.4,40.8],[62.4,45.8],[62.6,40.8],[62.8,46],[63.2,41.6],[63.4,36.2],[63.4,46.8],[63.6,42.4],[63.8,36.4],[63.8,42.8],[63.8,52.8],[64.2,52.2],[64.4,36.8],[64.4,46.4],[64.4,46.6],[64.6,37],[64.6,46.6],[65,46.2],[65.4,37.8],[65.4,50.2],[65.4,50.6],[65.4,64],[65.6,50],[66,38.4],[66.2,45.8],[66.4,38.6],[66.4,64.2],[66.6,38.8],[66.6,46],[66.8,44.8],[66.8,64.2],[67.4,39.6],[67.4,70.8],[67.6,39.4],[67.6,45.2],[67.8,40],[68,64.2],[68,71.6],[69,54.4],[69,71.6],[69.2,45.4],[69.2,49.2],[69.2,55.4],[69.2,56],[69.2,63.6],[69.4,46],[69.4,49.8],[69.4,51],[69.4,52.2],[69.4,52.6],[69.6,46.2],[69.6,50.6],[69.6,51.6],[69.6,52.6],[69.8,71.6],[70,57],[70.2,71.4],[70.4,46.6],[70.6,46.8],[71.6,61.8],[71.8,47.2],[72,47.6],[72,60.4],[72,60.8],[72.4,59.4],[72.6,59],[73.6,58.8]], objective: 0, id: 18334, reactalliance: 0, reacthorde: 0, item: 'Pair of Ivory Tusks'}]}}
}, zoneparent: 'lksjdowlha', zones: [[3518,2]], missing: 0}
Примечание:
Полноценно первый json выглядит вот так
<script type="text/javascript">//<![CDATA[
var _ = {};
_[9914]={name_enus:'A Head Full of Ivory'};
$.extend(true, g_quests, _);
_ = g_quests;
$.extend(g_quests[9914], {"category":3518,"category2":8,"id":9914,"level":66,"money":35000,"name":"A Head Full of Ivory","reprewards":[[933,250]],"reqlevel":64,"side":3,"wflags":128,"xp":11300});
var _ = {};
_[25463]={name_enus:'Pair of Ivory Tusks',quality:1,icon:'INV_Misc_Bone_04',sellprice:500};
$.extend(true, g_items, _);
_ = g_items;
var _ = {};
$.extend(true, g_spells, _);
_ = g_spells;
//]]></script>
Примечание:
А второй вот так
<script type="text/javascript">//<![CDATA[
var g_mapperData = {};
var myMapper = new Mapper({parent: 'fweiuasf', objectives: {
3518: {zone: 'Nagrand', mappable: 1, levels: {0: [{ type: '1', point: 'start', name: 'Shadrek', coord: [31.6,56.8], coords: [[31.6,56.8]], id: 18333, reactalliance: 1, reacthorde: 1},{ type: '1', point: 'end', name: 'Shadrek', coord: [31.6,56.8], coords: [[31.6,56.8]], id: 18333, reactalliance: 1, reacthorde: 1},{ type: '1', point: 'sourcerequirement', name: 'Wild Elekk', coord: [69.6,46.2], coords: [[25.2,54.8],[25.4,54.2],[25.6,53.8],[26.2,52.4],[26.2,52.6],[26.4,34.4],[26.4,50.6],[27.2,34.4],[27.2,34.6],[29.2,61.4],[29.4,61.6],[29.6,62.4],[29.8,63.4],[29.8,63.8],[30.4,64.8],[30.8,64.4],[31,64.6],[32.6,77.4],[33,29.2],[33,29.6],[33.2,28.4],[33.2,31.2],[33.6,78],[34.2,59.6],[34.4,59.4],[34.6,59.6],[35,78.4],[35.2,59.2],[35.2,78.6],[35.6,79.4],[35.8,59],[36,79.6],[36.6,59.4],[36.6,60],[36.6,60.6],[37,22.8],[38.4,58.8],[38.6,24.4],[38.6,59],[39.6,59.4],[40,54],[40,60],[40.6,54.4],[40.6,60.6],[40.8,54.6],[41,55.6],[41.2,60.2],[43,27.4],[43,27.6],[43,77],[43.2,76.4],[43.6,27.2],[44,76.2],[44.2,57.4],[44.4,26.4],[44.6,26.2],[44.6,76],[45.2,58.2],[45.4,75.2],[45.6,58.6],[46.2,27],[46.8,27],[46.8,75.2],[47,71.4],[47,72.4],[47,73.8],[47.2,70.4],[47.2,73.4],[47.8,70.2],[48.4,39.2],[48.4,39.6],[49,29.4],[49,64.2],[49.2,61.6],[49.4,30.2],[49.4,38.6],[49.4,61.4],[49.4,62.6],[49.6,30.4],[49.6,38.6],[49.6,63.2],[49.8,30.6],[49.8,61],[50,38.4],[50.4,60.4],[50.8,39.4],[51.2,30.8],[51.2,40],[51.2,60],[51.8,30.8],[51.8,60],[54.2,46.4],[54.4,46.8],[54.6,46.6],[55,45.8],[55.4,45.2],[55.8,44.8],[56.2,44],[56.6,43.8],[57.2,43.4],[57.6,47.2],[58,46.4],[58,57.8],[58.2,59],[58.2,59.8],[58.2,62],[58.4,67.4],[59,45.6],[59,66.8],[59.2,45.4],[59.2,66.2],[59.4,41.4],[59.4,41.8],[59.6,42],[59.6,44.6],[59.8,43.2],[59.8,43.8],[60,64.8],[60.4,39.2],[60.6,39],[61.2,39.6],[61.4,61.6],[61.6,39.8],[61.8,35],[62,45.4],[62.4,40.8],[62.4,45.8],[62.6,40.8],[62.8,46],[63.2,41.6],[63.4,36.2],[63.4,46.8],[63.6,42.4],[63.8,36.4],[63.8,42.8],[63.8,52.8],[64.2,52.2],[64.4,36.8],[64.4,46.4],[64.4,46.6],[64.6,37],[64.6,46.6],[65,46.2],[65.4,37.8],[65.4,50.2],[65.4,50.6],[65.4,64],[65.6,50],[66,38.4],[66.2,45.8],[66.4,38.6],[66.4,64.2],[66.6,38.8],[66.6,46],[66.8,44.8],[66.8,64.2],[67.4,39.6],[67.4,70.8],[67.6,39.4],[67.6,45.2],[67.8,40],[68,64.2],[68,71.6],[69,54.4],[69,71.6],[69.2,45.4],[69.2,49.2],[69.2,55.4],[69.2,56],[69.2,63.6],[69.4,46],[69.4,49.8],[69.4,51],[69.4,52.2],[69.4,52.6],[69.6,46.2],[69.6,50.6],[69.6,51.6],[69.6,52.6],[69.8,71.6],[70,57],[70.2,71.4],[70.4,46.6],[70.6,46.8],[71.6,61.8],[71.8,47.2],[72,47.6],[72,60.4],[72,60.8],[72.4,59.4],[72.6,59],[73.6,58.8]], objective: 0, id: 18334, reactalliance: 0, reacthorde: 0, item: 'Pair of Ivory Tusks'}]}}
}, zoneparent: 'lksjdowlha', zones: [[3518,2]], missing: 0});
//]]></script>