Advertisement
Diggernaut

Public Schools in Illinois digger config

Feb 14th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.30 KB | None | 0 0
  1. ---
  2. config:
  3.     debug: 2
  4.     agent: "Firefox"
  5. do:
  6. - walk:
  7.     to: 'http://www.illinoisschools.com/schools/public.aspx'
  8.     do:
  9.     - find:
  10.         path: 'a.linkSmallclean'
  11.         do:
  12.         - parse:
  13.             attr: href
  14.         - walk:
  15.             to: value
  16.             do:
  17.             - find:
  18.                 path: div#AllSchoolData
  19.                 do:
  20.                 - find:
  21.                     path: tr>td:nth-of-type(2)>b>a
  22.                     do:
  23.                     - parse:
  24.                         attr: href
  25.                     - walk:
  26.                         to: value
  27.                         do:
  28.                         - find:
  29.                             path: td[valign="top"]:has(a:contains('Get Directions'))
  30.                             do:
  31.                             - split:
  32.                                 context: html
  33.                                 delimiter: '<br/>'
  34.                             - object_new: school
  35.                             - find:
  36.                                 path: div.element_0
  37.                                 do:
  38.                                - parse
  39.                                 - object_field_set:
  40.                                     object: school
  41.                                     field: name
  42.                             - find:
  43.                                 path: div.element_1
  44.                                 do:
  45.                                - parse
  46.                                 - object_field_set:
  47.                                     object: school
  48.                                     field: street
  49.                             - find:
  50.                                 path: div.element_2
  51.                                 do:
  52.                                 - parse:
  53.                                     filter: \s*([^,]+),
  54.                                 - object_field_set:
  55.                                     object: school
  56.                                     field: city
  57.                             - register_set: IL
  58.                             - object_field_set:
  59.                                 object: school
  60.                                 field: state
  61.                             - find:
  62.                                 path: div.element_2
  63.                                 do:
  64.                                 - parse:
  65.                                     filter: (\d+)
  66.                                 - object_field_set:
  67.                                     object: school
  68.                                     field: zip
  69.                             - find:
  70.                                 path: div.element_4
  71.                                 do:
  72.                                 - parse:
  73.                                     filter: '(.+)\s+County,\s+Illinois'
  74.                                 - object_field_set:
  75.                                     object: school
  76.                                     field: county
  77.                             - find:
  78.                                 path: div.element_5
  79.                                 do:
  80.                                - parse
  81.                                 - object_field_set:
  82.                                     object: school
  83.                                     field: phone
  84.                             - object_save:
  85.                                 name: school
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement