Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update Main.java
  • Loading branch information
jjv14001 committed Feb 6, 2019
1 parent fdd30a4 commit f4477c0
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions MHealth_GroupFBScraper/src/Main.java
Expand Up @@ -48,14 +48,11 @@ public class Main {
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);
}
}
Expand All @@ -66,20 +63,10 @@ public class Main {
}
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 {
Expand Down

0 comments on commit f4477c0

Please sign in to comment.