官术网_书友最值得收藏!

Getting data from the Twitter Streaming API

The data for our React application will come from Twitter. Twitter has a Streaming API that anyone can plug into and start receiving an endless flow of public tweets in the JSON format.

To start using the Twitter Streaming API, you'll need to perform the following steps:

  1. Create a Twitter account. For this, go to https://twitter.com and sign up; or sign in if you already have an account.
  2. Create a new Twitter app by navigating to https://apps.twitter.com, and click on Create New App. You will need to fill the Application Details form, agree with Developer Agreement, and click on Create your Twitter application. Now you should see your application's page. Switch to the Keys and Access Tokens tab.

In the Application Settings section of this page, you'll find two vital pieces of information:

  • Consumer Key (API Key), for example, jqRDrAlKQCbCbu2o4iclpnvem
  • Consumer Secret (API Secret), for example, wJcdogJih7uLpjzcs2JtAvdSyCVlqHIRUWI70aHOAf7E3wWIgD

Take a note of these; we will need them later in this chapter.

Now we need to generate an access token. On the same page, you'll see the Your Access Token section that is empty. Click on the Create my access token button. It creates two pieces of information:

  • Access Token, for example, 12736172-R017ah2pE2OCtmi46IAE2n0z3u2DV6IqsEcPa0THR
  • Access Token Secret, for example, 4RTJJWIezIDcs5VX1PMVZolXGZG7L3Ez7Iz1gMdZucDaM

Take a note of these too. An access token is unique to you and you should not share it with anyone. Keep it private.

Now we have everything that we need to start using Twitter's Streaming API.

主站蜘蛛池模板: 泗洪县| 昌黎县| 镇坪县| 墨竹工卡县| 柞水县| 天全县| 大连市| 平乡县| 保靖县| 漳平市| 尉犁县| 牡丹江市| 陈巴尔虎旗| 雷州市| 土默特左旗| 若尔盖县| 湖口县| 绿春县| 平泉县| 祁东县| 石屏县| 甘洛县| 吴堡县| 凯里市| 兴仁县| 台前县| 永丰县| 汤阴县| 武乡县| 托克托县| 东乡县| 三明市| 黑河市| 黎城县| 石棉县| 海阳市| 阜阳市| 新巴尔虎左旗| 如皋市| 怀安县| 比如县|