Skip to content
Permalink
Browse files

Update Main.java

  • Loading branch information
jjv14001 committed Feb 6, 2019
1 parent fdd30a4 commit f4477c01e810b0afc06a27a037251e74b1a7f75e
Showing with 7 additions and 20 deletions.
  1. +7 −20 MHealth_GroupFBScraper/src/Main.java
@@ -48,14 +48,11 @@ public static void main(String[] args) {
while(groupIt.hasNext()) {
List<Group> page = groupIt.next();
for(Group currGroup : page) {

//System.out.println("Do you want to get posts from "+currGroup.getName()+" ? Yes/NO"); // Eventually switch to GUI
//String response = input.nextLine();
//if(response.equals("Yes")) {
// Removed above lines for testing (will need them in the future but not now since I'm only testing on one group)
if(currGroup.getId().equals("250530099176185")){
// Will need to be changed in final version
System.out.println("Do you want to get posts from "+currGroup.getName()+" ? Yes/NO"); // Eventually switch to GUI
String response = input.nextLine();
if(response.equals("Yes")) {
Connection<Post> postFeed = fbClient.fetchConnection(currGroup.getId()+"/feed", Post.class, Parameter.with("fields","from,actions,message,likes,reactions,story,type,link,picture,created_time,comments"));
// Note - ask Jess if they want to be able to specify a start date / end date when pulling data
writeCSVData(currGroup, postFeed, fbClient, userAccessTokens);
}
}
@@ -66,20 +63,10 @@ public static void main(String[] args) {
}
public static void writeCSVData(Group currGroup, Connection<Post> postFeed, FacebookClient fbClient, String[] userApprovals)
{
// TODO - Finish
// File Name should be of format: Health Chat_Data Type_Group Name_Date Pulled.csv

/*
*
* Files needed:
* comments - headers: PostId, Id, UserId, UserName, CreatedTime, Message
* chat_feed - headers: Id, UserId, UserName, CreatedTime, Status Type, Message, Story, Link, Picture
* likes - headers: ObjectId, UserId, UserName
* reactions - headers: ObjectId, UserId, UserName, Type
*
*/


Iterator<List<Post>> it = postFeed.iterator();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yyyy hh.mm.ss");
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM.dd.yyyy hh.mm.ss");
LocalDateTime now = LocalDateTime.now();
DateFormat csvDateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
try {

0 comments on commit f4477c0

Please sign in to comment.
You can’t perform that action at this time.