Created
April 9, 2013 16:01
-
-
Save crackcomm/5346948 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
html = require './html' | |
q = require './q' | |
{sequence} = q | |
{unpatch} = html | |
index = 'http://rozklady.mzkjastrzebie.com/index.php?MenuItem=2' | |
action = | |
parseUrl: index | |
domSelect: 'table tbody tr' | |
map: | |
extract: [ | |
id: path: 'td:nth-child(1)', get: 'text' | |
community: path: 'td:nth-child(2)', get: 'text' | |
stop: path: 'td:nth-child(3)', get: 'text' | |
lines: | |
path: 'td:nth-child(4) a' | |
get: 'map href' | |
] | |
slice: [1, 5] | |
seq = sequence unpatch action | |
seq.then (res) -> | |
console.log "End :)", res |
This file contains hidden or 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
End :) [ { id: '1', | |
community: '', | |
stop: 'Rydułtowy Bednorz Pętla', | |
lines: [ 'index.php?LiniaId=193' ] }, | |
{ id: '2', | |
community: 'CZERWIONKA-LESZCZYNY', | |
stop: 'Bełk Pętla', | |
lines: [ 'index.php?LiniaId=131', 'index.php?LiniaId=117' ] }, | |
{ id: '3', | |
community: 'CZERWIONKA-LESZCZYNY', | |
stop: 'Bełk Poczta', | |
lines: [ 'index.php?LiniaId=131', 'index.php?LiniaId=117' ] }, | |
{ id: '4', | |
community: 'CZERWIONKA-LESZCZYNY', | |
stop: 'Bełk Palowicka', | |
lines: [ 'index.php?LiniaId=134' ] } ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment