List of usage examples for twitter4j Paging Paging
public Paging()
From source file:org.sociotech.communitymashup.source.twitter.TwitterSourceService.java
License:Open Source License
/** * Adds the User Timeline/* w w w.j ava2s .c om*/ */ private void addUserTimeline() { List<Status> userTimeline = null; // List of statuses try { Paging userTimelineParam = new Paging(); userTimelineParam.setCount(getNumberOfUserTimelineTweets()); userTimeline = twitterAPI.getUserTimeline(userTimelineParam); } catch (TwitterException te) { log("Could not get User Timeline from Twitter. (" + te.getMessage() + ")", LogService.LOG_ERROR); return; } addTweetList(userTimeline); }
From source file:org.tweetalib.android.TwitterPaging.java
License:Apache License
public Paging getT4JPaging() { Paging result = new Paging(); if (mMaxId == null && mSinceId == null) { if (mPage != null) { result.setPage(mPage);/*from w ww . ja v a2s.co m*/ } else { result.setPage(1); } } else { if (mMaxId != null) { if (mMaxId.longValue() >= 0) { result.setMaxId(mMaxId); } else { Log.d("ERROR", "mMaxId is " + mMaxId.longValue() + ", must be >= 0"); } } if (mSinceId != null) { if (mSinceId.longValue() >= 0) { result.setSinceId(mSinceId); } else { Log.d("ERROR", "mSinceId is " + mSinceId.longValue() + ", must be >= 0"); } } } if (mCount != null) { result.setCount(mCount); } else { result.setCount(DEFAULT_STATUS_COUNT); } return result; }
From source file:proyectotwitter.AppTwitter.java
public void verTimeline() { try {/*w w w . j ava 2s . com*/ Paging pagina = new Paging(); pagina.setCount(40); ResponseList listado = twitter.getHomeTimeline(pagina); for (int i = 0; i < listado.size(); i++) { System.out.println(listado.get(i).toString()); } } catch (TwitterException ex) { System.out.println("Error al ver la linea de tiempo"); } }
From source file:tientx.supercode.myproejectdemov3.service.TwitterServiceImpl.java
@Override public ResponseList<Status> getTwUserHomeTimeline(Long idUser, Integer count) throws TwitterException, InterruptedException { Paging pg = new Paging(); pg.setCount(count);// w w w.j av a 2 s . c om overError88(TwitterConfig.USER_HOME_TIMELINE); return twitter.getUserTimeline(idUser, pg); }
From source file:tientx.supercode.myproejectdemov3.service.TwitterServiceImpl.java
@Override public ResponseList<Status> getTwFavorites(String screenName, Integer count) throws TwitterException, InterruptedException { Paging pg = new Paging(); pg.setCount(count);//w w w. java 2 s . co m overError88(TwitterConfig.USER_FAVORITES_LIST); return twitter.getFavorites(screenName, pg); }
From source file:tientx.supercode.myproejectdemov3.service.TwitterServiceImpl.java
@Override public ResponseList<Status> getTwFavorites(Long idUser, Integer count) throws TwitterException, InterruptedException { Paging pg = new Paging(); pg.setCount(count);/*from w ww .j av a 2s . c o m*/ overError88(TwitterConfig.USER_FAVORITES_LIST); return twitter.getFavorites(idUser, pg); }
From source file:twit.Twit.java
public void userMention() throws SQLException, ParseException { Twitter twitter = new TwitterFactory().getInstance(); try {/*from w w w . j a v a 2 s.com*/ Long since_id = cek_last_mention(); Paging paging = new Paging().sinceId(since_id); List<Status> statuses = twitter.getMentionsTimeline(paging); for (twitter4j.Status status : statuses) { long ID_TWEET = status.getId(); String USERNAME = status.getUser().getScreenName(); String TWEET = status.getText().replace("'", "\\'"); save_user(USERNAME); String ID_MASYARAKAT = cekMasyarakat(USERNAME); if (USERNAME.equals("tahupongcode")) { //reply akun sendiri save_data_mentions(ID_TWEET); } else { if (Regex(TWEET)[0].equals("harga")) { //masukkan hasil regex pada array String[] hasil = Regex(TWEET); //ambil isi array int KOMODITAS = cekKomoditas(hasil[2]); String TITIK_DISTRIBUSI = cekTitik(hasil[3]); String HARGA = hasil[4]; save_harga(KOMODITAS, TITIK_DISTRIBUSI, ID_MASYARAKAT, USERNAME, HARGA); if (cek_replied(ID_TWEET) == false) { save_data_mentions(ID_TWEET); onStatus(status, 1); } } else if (Regex(TWEET)[0].equals("keluhan")) { //masukkan hasil regex pada array String[] hasil = Regex(TWEET); //ambil isi array String SUBJECT = hasil[2]; String KELUHAN = hasil[3]; String KABUPATEN = cekKabupaten(hasil[4]); insertKeluhan(ID_MASYARAKAT, SUBJECT, KELUHAN, KABUPATEN); if (cek_replied(ID_TWEET) == false) { save_data_mentions(ID_TWEET); onStatus(status, 2); } } else { System.out.println("error"); } } } } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); System.exit(-1); } }