Advertisement
Diggernaut

Private Schools in Illinois digger config

Feb 14th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.35 KB | None | 0 0
  1. ---
  2. config:
  3.     debug: 2
  4.     agent: "Firefox"
  5. do:
  6. - walk:
  7.     to: 'http://www.illinoisschools.com/private-schools/'
  8.     do:
  9.     - find:
  10.         path: table.DataTable
  11.         do:
  12.         - find:
  13.             path: a
  14.             do:
  15.             - parse:
  16.                 attr: href
  17.             - walk:
  18.                 to: value
  19.                 do:
  20.                 - find:
  21.                     path: table.DataTable
  22.                     do:
  23.                     - find:
  24.                         path: a
  25.                         do:
  26.                         - parse:
  27.                             attr: href
  28.                         - walk:
  29.                             to: value
  30.                             do:
  31.                             - find:
  32.                                 path: table:has(h1)
  33.                                 do:
  34.                                 - object_new: school
  35.                                 - find:
  36.                                     path: h1
  37.                                     do:
  38.                                    - parse
  39.                                     - object_field_set:
  40.                                         object: school
  41.                                         field: name
  42.                                 - parse:
  43.                                     filter: ยป\s+(.+)\s+County\s+ยป
  44.                                 - object_field_set:
  45.                                     object: school
  46.                                     field: county
  47.                                 - find:
  48.                                     path: table[cellpadding="3"]
  49.                                     do:
  50.                                     - find:
  51.                                         path: tr:contains('School Address:')>td:nth-of-type(2)
  52.                                         do:
  53.                                         - parse:
  54.                                             filter: ^([^,]+),
  55.                                         - object_field_set:
  56.                                             object: school
  57.                                             field: street
  58.                                         - parse:
  59.                                             filter: ^[^,]+,\s+([^,]+),
  60.                                         - object_field_set:
  61.                                             object: school
  62.                                             field: city
  63.                                         - register_set: IL
  64.                                         - object_field_set:
  65.                                             object: school
  66.                                             field: state
  67.                                         - register_set: ''
  68.                                         - object_field_set:
  69.                                             object: school
  70.                                             field: zip
  71.                                     - find:
  72.                                         path: tr:contains('Phone Number:')>td:nth-of-type(2)
  73.                                         do:
  74.                                        - parse
  75.                                         - object_field_set:
  76.                                             object: school
  77.                                             field: phone
  78.                                 - object_save:
  79.                                     name: school
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement