Каким инструменотом Grab это удобнее сделать?
Вот часть кода страницы:
…………
{"phoenician_salesman_hint":false,"militia_hint":false,"player_protection_finished_hint":true,"build_time_reduction_hint":false,"age_of_wonder_hint":false,"display_new_year_hint":false,"world_ends_hint":false,"grepolympia_hint":false};
Layout.militia_hint_shown = false;
Layout.show_confirmation_popup = true;
Layout.displayServerTime();
ITowns.initialize({"groups":null,"towns":[{"id":694,"name":"55 Seganapa-7 F","island_x":537,"island_y":516,"plenty":"iron","rare":"wood","has_conqueror":false,"researches":{"berth":true,"conscription":true,"mathematics":true},"favor":500},{"id":57457,"name":"55 \u0421\u043f\u0430\u0440\u0442\u0430","island_x":537,"island_y":516,"plenty":"iron","rare":"wood","has_conqueror":false,"researches":{"berth":true,"conscription":true,"mathematics":true},"favor":500}],"tmpl":"<div class=\"box top left\">\n\t<div class=\"box top right\">\n\t\t<div class=\"box top center\"><\/div>\n\t<\/div>\n<\/div>\n<div class=\"box middle left\">\n\t<div class=\"box middle right\">\n\t\t<div class=\"
……………
Спарсить мне нужно то что находится между ITowns.initialize и “tmpl”, а дальше мне нужно будет использовать эти данные в коде…
xPath как я понимаю мне не поможет? т.к. текст не находится в тэгах. Нужна регулярка? Первый раз приходится парсить в Grab, как удобнее всего получить нужные мне Json данные???
.*),"storage')
File "C:\Python27\Lib\site-packages\grab-0.4.5-py2.7.egg\grab\ext\rex.py", line 28, in rex_text
raise DataNotFound('Regexp not found')
grab.error.DataNotFound: Regexp not found