Advertisement
Diggernaut

U.S. Department of Health Digger Config

Feb 14th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.15 KB | None | 0 0
  1. ---
  2. config:
  3.     agent: Firefox
  4.     debug: 2
  5. do:
  6. - link_add:
  7.     pool: c
  8.     url: "https://www.healthdata.gov/search/field_topic/hospital-17821?query=&sort_by=changed&sort_order=DESC"
  9. - walk:
  10.     to: links
  11.     pool: c
  12.     do:
  13.     - find:
  14.         path: .search-result-dataset > h2 > a
  15.         do:
  16.         - parse:
  17.             attr: href
  18.         - normalize:
  19.             routine: url
  20.         - walk:
  21.             to: value
  22.             do:
  23.             - find:
  24.                 path: body
  25.                 do:
  26.                 - object_new: item
  27.                 - find:
  28.                     path: div[property="content:encoded"]
  29.                     do:
  30.                    - parse
  31.                     - object_field_set:
  32.                         object: item
  33.                         field: description
  34.                 #1 table
  35.                 - find:
  36.                     path: table.field-group-format.group_additional
  37.                     do:
  38.                     - find:
  39.                         path: tbody > tr
  40.                         do:
  41.                         - find:
  42.                             path: th
  43.                             do:
  44.                            - parse
  45.                             - variable_clear: header
  46.                             - variable_set: header
  47.                         - find:
  48.                             path: td
  49.                             do:
  50.                            - parse
  51.                             - object_field_set:
  52.                                 object: item
  53.                                 field: <%header%>
  54.                 #2 table
  55.                 - find:
  56.                     path: .table-responsive > table
  57.                     do:
  58.                     - find:
  59.                         path: tbody > tr
  60.                         do:
  61.                         - find:
  62.                             path: td
  63.                             slice: 0
  64.                             do:
  65.                            - parse
  66.                             - variable_clear: header
  67.                             - variable_set: header
  68.                         - find:
  69.                             path: td
  70.                             slice: 1
  71.                             do:
  72.                            - parse
  73.                             - object_field_set:
  74.                                 object: item
  75.                                 field: <%header%>
  76.                 - object_save:
  77.                     name: item
  78.     - find:
  79.         path: .pagination.pager
  80.         do:
  81.        - parse
  82.         - if:
  83.             match: "next"
  84.             do:
  85.             - find:
  86.                 path: .pager-next > a
  87.                 do:
  88.                 - parse:
  89.                     attr: href
  90.                 - normalize:
  91.                     routine: url
  92.                 - link_add:
  93.                     pool: c
  94.             else:
  95.             - pool_clear: c
  96.             - find:
  97.                 path: .pager-first.first > a
  98.                 do:
  99.                 - parse:
  100.                     attr: href
  101.                 - normalize:
  102.                     routine: url
  103.                 - link_add:
  104.                     pool: c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement