python - how to access latitude and longtitude in a script with beautifulsoup? -


i want latitude , longitude webpage using beautifulsoup in script:

//<![cdata[  theform.oldsubmit = theform.submit; theform.submit = webform_savescrollpositionsubmit;  theform.oldonsubmit = theform.onsubmit; theform.onsubmit = webform_savescrollpositiononsubmit; var gmapsproperties={};function getgmapelementbyid(mapid,gmapelementid){var _mapid=typeof(mapid)=='string'? mapid : mapid.getdiv().id;var overlayarray=gmapsproperties[_mapid]['overlayarray'];for(var i=0;i < overlayarray.length;i++){if(overlayarray[i][0]==gmapelementid){return overlayarray[i][1];}}return null;}function removegmapelementbyid(mapid,gmapelementid){var _mapid=typeof(mapid)=='string'? mapid : mapid.getdiv().id;var overlayarray=gmapsproperties[_mapid]['overlayarray'];for(var i=0;i < overlayarray.length;i++){if(overlayarray[i][0]==gmapelementid){overlayarray.splice(i,1);return;}}}function closewindows(mapid){for(var i=0;i<gmapsproperties[mapid]['windowarray'].length;i++){gmapsproperties[mapid]['windowarray'][i][1].close();}}var _sg=_sg ||{};_sg.cs=(function(){var p={};p.createmarker=function(opt,id){var m=new google.maps.marker(opt);if(id && m.getmap())gmapsproperties[m.getmap().getdiv().id]['overlayarray'].push([id,m]);return m;};p.createpolyline=function(opt,id){var m=new google.maps.polyline(opt);if(id && m.getmap())gmapsproperties[m.getmap().getdiv().id]['overlayarray'].push([id,m]);return m;};p.createpolygon=function(opt,id){var m=new google.maps.polygon(opt);if(id && m.getmap())gmapsproperties[m.getmap().getdiv().id]['overlayarray'].push([id,m]);return m;};return p;})();function addevent(el,ev,fn){if(el.addeventlistener)el.addeventlistener(ev,fn,false);else if(el.attachevent)el.attachevent('on'+ev,fn);else el['on'+ev]=fn;}gmapsproperties['subgurim_googlemapcontrol'] = {}; var gmapsproperties_subgurim_googlemapcontrol = gmapsproperties['subgurim_googlemapcontrol']; gmapsproperties_subgurim_googlemapcontrol['enablestore'] = false; gmapsproperties_subgurim_googlemapcontrol['overlayarray'] = new array(); gmapsproperties_subgurim_googlemapcontrol['windowarray'] = new array();var subgurim_googlemapcontrol;function load_subgurim_googlemapcontrol(){var mapdom = document.getelementbyid('subgurim_googlemapcontrol'); if (!mapdom) return;subgurim_googlemapcontrol = new google.maps.map(mapdom);function subgurim_googlemapcontrolupdatevalues(eventid,value){var item=document.getelementbyid('subgurim_googlemapcontrol_event'+eventid);item.value=value;}google.maps.event.addlistener(subgurim_googlemapcontrol, 'addoverlay', function(overlay) { if(overlay) { gmapsproperties['subgurim_googlemapcontrol']['overlayarray'].push(overlay); } });google.maps.event.addlistener(subgurim_googlemapcontrol, 'clearoverlays', function() { gmapsproperties['subgurim_googlemapcontrol']['overlayarray'] = new array(); });google.maps.event.addlistener(subgurim_googlemapcontrol, 'removeoverlay', function(overlay) { removegmapelementbyid('subgurim_googlemapcontrol',overlay.id) });google.maps.event.addlistener(subgurim_googlemapcontrol, 'maptypeid_changed', function() { var tipo = subgurim_googlemapcontrol.getmaptypeid(); subgurim_googlemapcontrolupdatevalues('0', tipo);});google.maps.event.addlistener(subgurim_googlemapcontrol, 'dragend', function() { var lat = subgurim_googlemapcontrol.getcenter().lat(); var lng = subgurim_googlemapcontrol.getcenter().lng(); subgurim_googlemapcontrolupdatevalues('2', lat+','+lng); });google.maps.event.addlistener(subgurim_googlemapcontrol, 'zoom_changed', function() { subgurim_googlemapcontrolupdatevalues('1', subgurim_googlemapcontrol.getzoom()); });subgurim_googlemapcontrol.setoptions({center:new google.maps.latlng(35.6783546483511,51.4196634292603),disabledefaultui:true,keyboardshortcuts:false,maptypecontrol:false,maptypeid:google.maps.maptypeid.roadmap,scrollwheel:false,zoom:14});var marker_subgurim_920435_=_sg.cs.createmarker({position:new google.maps.latlng(35.6783546483511,51.4196634292603),clickable:true,draggable:false,map:subgurim_googlemapcontrol,raiseondrag:true,visible:true,icon:'/images/markers/site/tourism/vase.png'}, 'marker_subgurim_920435_');}addevent(window,'load',load_subgurim_googlemapcontrol);//]]> 

and want information in part:

{position:new google.maps.latlng(35.6783546483511,51.4196634292603) 

is possible access information using beautifulsoup or other web-scrapper?

use regular expression purpose.

import re #suppose script stored in variable script_file m = re.search('latlng(\(.+?\))', script_file)  latlng = m.group(1) latlng = eval(latlng) print(latlng) #(35.6783546483511, 51.4196634292603) 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -