Skip to content

Instantly share code, notes, and snippets.

@rla
Created March 17, 2016 13:32
Show Gist options
  • Save rla/e0cb48c127d3102e6202 to your computer and use it in GitHub Desktop.
Save rla/e0cb48c127d3102e6202 to your computer and use it in GitHub Desktop.
Facebook group posts extraction
posts(GroupUrl, Posts):-
Query = _{
wait: 5300,
url: GroupUrl,
extract: _{
posts: _{
type: collection,
selector: '.userContentWrapper',
extract: _{
title: _{ selector: 'h5' },
url: _{
selector: 'h5 + div > div > span > span > a',
property: 'href'
},
texts: _{
type: collection,
selector: '.userContent',
extract: _{
text: _{ selector: ':root' }
}
}
}
}
}
},
query(Query, Response),
maplist(drop_empty_texts, Response.posts, Posts).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment