Skip to content

Instantly share code, notes, and snippets.

@metasyn
Created January 4, 2016 05:11
Show Gist options
  • Save metasyn/3e925736d00c63e1f989 to your computer and use it in GitHub Desktop.
Save metasyn/3e925736d00c63e1f989 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>A simple map</title>
<!-- Initalize viewport -->
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Deps -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<!-- CSS -->
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<!-- Inline, just for now -->
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
// ACCESS KEY OMG - easy to change online though if we suspect abuse
L.mapbox.accessToken = 'pk.eyJ1IjoibWV0YXN5biIsImEiOiIwN2FmMDNhNTRhOWQ3NDExODI1MTllMDk1ODc3NTllZiJ9.Bye80QJ4r0RJsKj4Sre6KQ';
// Init map
var map = L.mapbox.map('map', 'mapbox.streets')
.setView([40, -74.50], 9);
// Scaper
// data
var url = "http://www.foopee.com/punk/the-list/by-date.0.html";
// xpath
var xpath = "//body/ul/li";
// query
var query = "select * from html where url='" + url + "' and xpath='" + xpath + "'";
// query
var yql = "https://query.yahooapis.com/v1/public/yql?format=json&q=" + encodeURIComponent(query);
// request
$.getJSON(yql, callback);
function callback(data){
console.log(data)
}
console.log(json)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment