Example usage for twitter4j.conf ConfigurationBuilder setDebugEnabled

List of usage examples for twitter4j.conf ConfigurationBuilder setDebugEnabled

Introduction

In this page you can find the example usage for twitter4j.conf ConfigurationBuilder setDebugEnabled.

Prototype

public ConfigurationBuilder setDebugEnabled(boolean debugEnabled) 

Source Link

Usage

From source file:com.wso2.stream.connector.protocol.TwitterPollingConsumer.java

License:Open Source License

/**
 * Setting up a connection with Twitter Stream API with the given credentials
 *//*from w ww .j  ava 2s  .com*/
private void setupConnection() {
    StatusListener listener = new StatusListenerImpl();

    ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
    configurationBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)
            .setOAuthConsumerSecret(consumerSecret).setOAuthAccessToken(accessToken)
            .setOAuthAccessTokenSecret(accessSecret);

    TwitterStream twitterStream = new TwitterStreamFactory(configurationBuilder.build()).getInstance();
    twitterStream.addListener(listener);

    FilterQuery query = new FilterQuery();
    query.language(new String[] { "en" });
    query.track(filterTags);
    twitterStream.filter(query);
}

From source file:Controller.DetailsmesoffresController.java

@FXML
void partageTwitter(ActionEvent event) throws TwitterException, FileNotFoundException {

    OffreService offreService = new OffreService();
    FXMLAfficheroffresController z = new FXMLAfficheroffresController();

    Offre x = offreService.findById(Integer.parseInt(FXMLAfficheroffresController.getLabelid()));

    ConfigurationBuilder cb = new ConfigurationBuilder();

    cb.setDebugEnabled(true).setOAuthConsumerKey("zFrvXiT4O6bPh7wtfX2qpxTJM")
            .setOAuthConsumerSecret("pZeG2yJ71HYSu3y8MC4sbOcAeKstRKmp8bVKfCOmxnd4QjsKmC")
            .setOAuthAccessToken("3345656831-F533Ns9kdMPI6GfmHwiVor3BUHM6kYJn4WO4xhq")
            .setOAuthAccessTokenSecret("1hWrntZlel0gOju0xOEVf2t5kRo2CjSp5H75sieOUfT89");

    TwitterFactory tf = new TwitterFactory(cb.build());

    twitter4j.Twitter tw = tf.getInstance();

    String pathphoto = x.getPhoto();
    String nomphoto = pathphoto.substring(62);
    System.out.println(nomphoto);

    File file = null;/*www .  ja va  2s.com*/
    file = new File(x.getPhoto());

    String StatusMessage = (x.getPtvente().getNom() + "\n" + x.getDescription() + "\n" + x.getTaux_remise());

    StatusUpdate status = new StatusUpdate(StatusMessage);
    status.setMedia(file);
    tw.updateStatus(status);

}

From source file:Controller.DetailsOffreController.java

@FXML
void partagersurtwitter(ActionEvent event) throws TwitterException {

    OffreService offreService = new OffreService();
    AfficherToutesOffresController z = new AfficherToutesOffresController();

    Offre x = offreService.findById(Integer.parseInt(AfficherToutesOffresController.getLabelid()));

    ConfigurationBuilder cb = new ConfigurationBuilder();

    cb.setDebugEnabled(true).setOAuthConsumerKey("zFrvXiT4O6bPh7wtfX2qpxTJM")
            .setOAuthConsumerSecret("pZeG2yJ71HYSu3y8MC4sbOcAeKstRKmp8bVKfCOmxnd4QjsKmC")
            .setOAuthAccessToken("3345656831-F533Ns9kdMPI6GfmHwiVor3BUHM6kYJn4WO4xhq")
            .setOAuthAccessTokenSecret("1hWrntZlel0gOju0xOEVf2t5kRo2CjSp5H75sieOUfT89");

    TwitterFactory tf = new TwitterFactory(cb.build());

    twitter4j.Twitter tw = tf.getInstance();

    String pathphoto = x.getPhoto();
    String nomphoto = pathphoto.substring(62);
    System.out.println(nomphoto);

    File file = null;//from   w w w .ja  v a2s . co m
    file = new File(x.getPhoto());

    String StatusMessage = (x.getPtvente().getNom() + "\n" + x.getDescription() + "\n" + x.getTaux_remise());

    StatusUpdate status = new StatusUpdate(StatusMessage);
    status.setMedia(file);
    tw.updateStatus(status);

}

From source file:CR.CERA.SensoryMotor.Twitter.Authorization.java

    public Authorization() throws IOException, TwitterException 
    { //  www. j a v  a2s  . com
        ConfigurationBuilder configBuilder = new ConfigurationBuilder();
        configBuilder.setDebugEnabled(true)
        .setOAuthConsumerKey("String con el Consumer key de la aplicacin (Ver en la web de Twitter Developer)")
        .setOAuthConsumerSecret("String con el Consumer secret de la aplicacin (Ver en la web de Twitter Developer)");
        
        Twitter OAuthTwitter = new TwitterFactory(configBuilder.build()).getInstance();
        RequestToken requestToken = null;
        AccessToken accessToken = null;
        String url = null;
    
}

From source file:crawler.util.OAuthUser.java

License:Apache License

public Configuration build(String consumerKey, String consumerSecret, String accessToken, String accessSecret) {
    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true).setOAuthConsumerKey(consumerKey).setOAuthConsumerSecret(consumerSecret)
            .setOAuthAccessToken(accessToken).setOAuthAccessTokenSecret(accessSecret);
    return cb.build();
}

From source file:crawlertwitter.TwitterDataStream.java

public TwitterDataStream() {

    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true).setJSONStoreEnabled(true)
            .setOAuthConsumerKey(utils.OAuthUtils.TWITTER_CONSUMER_KEY)
            .setOAuthConsumerSecret(utils.OAuthUtils.TWITTER_CONSUMER_SECRET)
            .setOAuthAccessToken(utils.OAuthUtils.OAUTH_TOKEN)
            .setOAuthAccessTokenSecret(utils.OAuthUtils.OAUTH_SECRET);
    twitterStream = new TwitterStreamFactory(cb.build()).getInstance();

}

From source file:crawling.FoundUsersBySearchGeo.java

License:Apache License

private static Twitter getOAuthTwitter() {

    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true)
            /*  .setOAuthConsumerKey("b81qmksOTVVMz9ZqjEVGsA")
              .setOAuthConsumerSecret("SYdycGH344dwM7Qt5BzDSiq8o3KepAtKC3XiaWIE")
              .setOAuthAccessToken("584842364-QOgpdKzRO2NVIoppceYkuSDquxyEa26FdSAXjkKc")
              .setOAuthAccessTokenSecret("oogO0og69qkRrLrk2zXGEE4oDYW2PeyZVss1IGPmOM");
             *///w  w  w.j a  va 2  s  .  c om
            /*.setOAuthConsumerKey("96vFsO7KxTojBCFWsig")
            .setOAuthConsumerSecret("zTxu00E7XlsKRgEz32FcTXrB5UhLEkSpZS1sK8n68w")
            .setOAuthAccessToken("591403328-85wymmBPZmGEwe8rXKog2HMzIup4tY8m2zU7NHg")
            .setOAuthAccessTokenSecret("kx9yya9NUDe1WQhYNDFKh1cg9fstm3RVptAUXlbA");*/

            .setOAuthConsumerKey("fDD11KrH0qNAQqnCKeA5vQ")
            .setOAuthConsumerSecret("BDh7COGEqjz38jsXwY3HnElkXtW8xCRGDq5vTWERY68")
            .setOAuthAccessToken("562640944-BesiZJVB4X4liIbzOVrI1YPdxZYJSBkB8TMSNrY")
            .setOAuthAccessTokenSecret("5rLAkUCBXkt3Ijp2wrqfxSHsOYPpYyq3GYv7b62xI8");

    //cb.setUseSSL(true); // This declaration is not needed in Twitter4J 4.0.2
    return new TwitterFactory(cb.build()).getInstance();
}

From source file:crawling.FoundUsersBySearchHashtag.java

License:Apache License

private static Twitter getOAuthTwitter() {

    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true).setOAuthConsumerKey("Oo1Np62vR41MJTeVViKMmA")
            .setOAuthConsumerSecret("9e2ad6usWLJikjoI4yNuDQ85rrf9eRvfLmUDRBPtZ8")
            .setOAuthAccessToken("701461304-mbDoQtYqtSG9Q2RHLlSBUFEgRWbKE0CpViYowNXs")
            .setOAuthAccessTokenSecret("aWeao9VabuGfphGcH83SozAwI0hgmlmg3ptS5KGGVs");

    /*cb.setDebugEnabled(true)
    .setOAuthConsumerKey(prop.getProperty("oauth.consumerKey"))
    .setOAuthConsumerSecret(prop.getProperty("oauth.consumerSecret"))
    .setOAuthAccessToken(prop.getProperty("oauth.accessToken"))
    .setOAuthAccessTokenSecret(prop.getProperty("oauth.accessTokenSecret"));*/

    return new TwitterFactory(cb.build()).getInstance();
}

From source file:crawling.FoundUsersByStreamHashtag.java

License:Apache License

private static TwitterStream getOAuthTwitterStream() {

    ConfigurationBuilder cb = new ConfigurationBuilder();
    /*cb.setDebugEnabled(true)
      .setOAuthConsumerKey("Oo1Np62vR41MJTeVViKMmA")
      .setOAuthConsumerSecret("9e2ad6usWLJikjoI4yNuDQ85rrf9eRvfLmUDRBPtZ8")
      .setOAuthAccessToken("700944906-6zdtjgw0Tskn90eDTB36sx1RCOaTff9C2zt1QYa8")
      .setOAuthAccessTokenSecret("x56tcXGBdQ2TZOs4Ci69Rm2QiUJMgjKVQTn1W7uM");*/

    cb.setDebugEnabled(true).setOAuthConsumerKey(prop.getProperty("oauth.consumerKey"))
            .setOAuthConsumerSecret(prop.getProperty("oauth.consumerSecret"))
            .setOAuthAccessToken(prop.getProperty("oauth.accessToken"))
            .setOAuthAccessTokenSecret(prop.getProperty("oauth.accessTokenSecret"));

    return new TwitterStreamFactory(cb.build()).getInstance();
}

From source file:crawling.GetUserTimelineMulti.java

License:Apache License

private Twitter getOAuthTwitter(String[] auth) {

    if (auth.length != 4) {
        System.out.println("The auth info is invalid!");
        System.exit(-1);/*from  w  w w.  j a  v  a 2  s  .  c o m*/
    }
    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true).setOAuthConsumerKey(auth[0]).setOAuthConsumerSecret(auth[1])
            .setOAuthAccessToken(auth[2]).setOAuthAccessTokenSecret(auth[3]);

    return new TwitterFactory(cb.build()).getInstance();
}