Created
January 4, 2016 05:23
-
-
Save metasyn/92a6cb01dc04b734ee65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> | |
var data; | |
// 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(response){ | |
data = response['query']['results']['li']; | |
} | |
function sortByDate(data){ | |
// stuff | |
} | |
function sortByVenue(data){ | |
// stuff | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment