文件

新聞分群

Service: https://news.api.yating.tw/v1
此服務從新聞、社群內容終將文章進行分群,達成事件挖掘與摘要。你可以直接藉由 RESTful API 輸入查詢條件後,就可以到相關事件,並進行適當的排序。此功能讓你不用閱讀逐篇文章,而是更快地從事件的角度切入,讓你更快了解全貌。
一個事件會由多篇新聞所組成,並且你可以取得跟這事件相關的社群文章。

1 取得事件列表

Request
URL: https://news.api.yating.tw/v1/event/list
Method: GET
Header
Name
Type
Info
Authorization
String
Bearer {key}
Parameter
Name
Type
Info
*startDate
string
請輸入距離今90天內的日期
E.g.
2022-09-26 13:50:55
*endDate
string
請輸入距離今90天內的日期
E.g.
2022-10-23 13:50:57
category
string
Leave it empty or “all” when you need all categories. You can query single category at once by using: category=business
Here are all categories:
all,
world,
technology,
business,
sports,
entertainment,
health,
science,
others
query
string
sourceLanguage
array
Default en. Origin source language, default is en.
Available values
: en, zh-hant
sort
string
With Keywords search:
datetime, relevance
Without Keywords search:
datetime, newsCount, socialIndicator:fbPosts, socialIndicator:fbComments, socialIndicator:fbLikes, socialIndicator:fbShares
order
string
Available values
: asc, desc
showCollaborativeGroups
Boolean
Default false, it’s for certain research purposes.
– Ture: if there is any collaborative group involved in an event, show all collaborative group ids in that event.
If False, it returns an empty array.
limit
int
Use this parameter to specify a pagination limit (number of results per page) for your API request. Default limit value is 1, maximum allowed limit value is 50.
after
string
search next page by token (just use the value of positionKey in here)
Response
Name
Type
Info
total
number
positionKey
string
events
object[]
eventId
sourceLanguage: string title: object, title in different language
hashtags
categories: string[]
0 Politics, 1 world, 2 technology, 3 business, 4 sports, 5 us, 6 entertainment, 7 china, 10000 others
datetime: datetime: string, event last update time
socialIndicators: it’s trending indicators for frontend services to evaluate an event. These values will be updated every 4 hours within 24 hours for each event.
collaborativeGroups: potential collaborative groups involved in an event.
Summary: string, a short event summary in multiple languages
previewPostList: object[], only parts of the total posts for preview on event level. If you require all posts, use v1/event/postlist
{
   "count":25,
   "positionKey":"290",
   "events":[
      {
         "eventId":"7bb8454a1b17",
         "sourceLanguage":"en",
         "title":{
            "en":"Democratic women call on Biden, Congress to protect federal abortion rights",
            "zh-hant":"民主黨婦女呼籲拜登,國會保護聯邦墮胎權"
         },
         "hashtags":[
            "Roe",
            "Supreme Court",
            "Biden",
            "Wade",
            "Americans"
         ],
         "categories":[
            "8",
            "1"
         ],
         "datetime":"2022-06-26T17:16:08Z",
         "postAmount":{
            "news":11
         },
         "collaborativeGroups":[
            
         ],
         "summary":{
            "en":"TORONTO (AP) -- Canadian Prime Minister Justin Trudeau warned Saturday that the U.S. Supreme Court decision to overturn a constitutional right to abortion could lead to the loss of other rights and indicated his country would continue to allow Americans to get abortions in Canada.",
            "zh-hant":"多倫多(美聯社) --加拿大總理特魯多週六警告說,美國最高法院推翻憲法規定的墮胎權的決定可能導致其他權利的喪失,並表示加拿大將繼續允許美國人在加拿大墮胎。"
         },
         "previewPostList":[
            {
               "source":"Reuters",
               "type":"news",
               "postedAt":"2022-06-26T17:16:08Z",
               "title":"Democratic women call on Biden, Congress to protect federal abortion rights",
               "uri":"https://www.reuters.com/world/us/democratic-women-call-biden-congress-protect-federal-abortion-rights-2022-06-26/"
            },
            {
               "source":"theguardian",
               "type":"news",
               "postedAt":"2022-06-26T16:40:34Z",
               "title":"The Guardian view on overturning Roe v Wade: anti-abortionists reign supreme",
               "uri":"https://www.theguardian.com/commentisfree/2022/jun/26/the-guardian-view-on-overturning-roe-v-wade-anti-abortionists-reign-supreme"
            },
            {
               "source":"TIME",
               "type":"news",
               "postedAt":"2022-06-26T15:24:15Z",
               "title":"With Roe Gone, Here's How to Save Abortion Rights",
               "uri":"https://time.com/6191376/roe-v-wade-end-abortion-rights/"
            }
         ],
         "socialIndicators":{
            "fbComments":169279,
            "fbLikes":321557,
            "fbShares":49997,
            "fbPosts":3268
         }
      }
   ]
}

2 取得事件內容

This is to get detailed information for an event.
Request
URL: /event/{eventId}/info
Method: GET
Header
Name
Type
Info
Authorization
String
Bearer {key}
Parameter
Name
Type
Info
*eventId
string
Response
Name
Type
Info
eventId
number
title
object
imgUri
string
hashtags
string[]
categories
categories[]
0 Politics, 1 world, 2 technology, 3 business, 4 sports, 6 entertainment, 8 health, 9 science, 10000 others
datetime
string
postTotal
object
The count of news related to this event.
summaries
object[]
originLanguage sentence: string Translation sentence: string sourcePost: object[]
{
   "eventId": "3b6df361664c",
   "sourceLanguage": "en",
   "title": {
       "en": "Solid U.S. job growth anticipated in May; unemployment rate seen at 3.5%",
       "zh-hant": "預計5月份美國就業增長穩健;失業率為3.5%",
       "source": "N-0ef0c7f2959dcd0a31abfba2a4b219c5a3d54e6b"
   },
   "postTotal": {
       "news": 25
   },
   "imgUri": "https://www.reuters.com/resizer/9b6cR7Le5HYfuQlq6GGG98XZ5ng=/1200x628/smart/filters:quality(80)/cloudfront-us-east-2.images.arcpublishing.com/reuters/UVFCYQV6F5NMXIISEH5ZKINIPQ.jpg",
   "hashtags": [
       "Fed",
       "U. S.",
       "Americans",
       "US",
       "Federal Reserve"
   ],
   "categories": [
       "3"
   ],
   "datetime": "2022-06-03T17:19:54Z",
   "summaries": [
       {
           "en": "WASHINGTON, June 3 (Reuters) - U.S. jobs gains of 390,000 in May and still strong wage growth leave the Federal Reserve on track for half point interest rate increases in June and July as the U.S. economy continued to show little evidence it is buckling under the pressure of high inflation and rising interest rates.",
           "zh-hant": "據路透社華盛頓6月3日報導,美國5月份就業增長39萬,工資增長依然強勁,這使得美聯儲有望在6月和7月升息半個百分點,因為美國經濟在高通脹和利率上升的壓力下繼續顯示出幾乎沒有證據表明它正在走向逆勢。",
           "sourcePost": {
               "source": "Reuters",
               "type": "news",
               "postedAt": "2022-06-03T17:19:54Z",
               "title": "U.S. jobs report shows Fed-friendly moderation, but still strong hiring",
               "uri": "https://www.reuters.com/markets/us/us-jobs-report-shows-fed-friendly-moderation-still-strong-hiring-2022-06-03/"
           }
       },
       {
           "en": "Nonfarm payrolls increased 390,000 last month after a revised 436,000 gain in April, a Labor Department report showed Friday. The unemployment rate held at 3.6%, and the labor force participation rate crept higher.",
           "zh-hant": "美國勞工部週五公佈的一份報告顯示,非農業就業人數在4月份經修正後增加了43.6萬人,上個月增加了39萬人,失業率保持在3.6% ,勞動力參與率也逐漸上升。",
           "sourcePost": {
               "source": "Fortune",
               "type": "news",
               "postedAt": "2022-06-03T08:50:24Z",
               "title": "U.S. job gains top estimates, unemployment rate holds at 3.6%",
               "uri": "https://fortune.com/2022/06/03/jobs-report-economy-labor-may/"
           }
       },
       {
           "en": "WASHINGTON, June 3 (Reuters) - U.S. employment likely increased at a brisk clip in May, with the jobless rate expected to have dropped to its pre-pandemic low of 3.5%, signs of a tight labor market that could keep the Federal Reserve's foot on the pedal to cool demand.",
           "zh-hant": "據路透社華盛頓6月3日報導,美國5月份的就業率可能會快速增長,失業率預計將降至大流行前3.5%的低點,這表明勞動力市場緊張,美聯儲可能會繼續為刺激需求而踩踏。",
           "sourcePost": {
               "source": "Reuters",
               "type": "news",
               "postedAt": "2022-06-03T04:05:16Z",
               "title": "Solid U.S. job growth anticipated in May; unemployment rate seen at 3.5%",
               "uri": "https://www.reuters.com/markets/us/solid-us-job-growth-anticipated-may-unemployment-rate-seen-35-2022-06-03/"
           }
       }
   ],
   "socialIndicators": {
       "fbComments": 0,
       "fbLikes": 0,
       "fbShares": 0,
       "fbPosts": 0
   }
}

3 查詢與此事件相關的文章

來源包含新聞、Ptt 與 Facebook
Request
URL: /event/{eventId}/postList
Method: GET
Header
Name
Type
Info
Authorization
String
Bearer {key}
Parameter
Name
Type
Info
*eventId
int
event ID
type
string
Available values : news, social
*limit
int
The numbers of items to return (default to 15)
after
string
(just use the value of positionKey in here)
Response
Name
Type
Info
positionKey
number
sourceList
object[]
{ "source": "經濟日報", "type": "news", "postedAt": "2022-02-20T06:51:24", "title": "拜登將召開國安會議 重申俄隨時會進攻烏克蘭", "uri": "
https://money.udn.com/money/story/replace_by_spider/6111105
",
"commentCounts"
:
3
}
{
   "count":15,
   "totalResults":302,
   "positionKey":"2022-05-17T14:01:37",
   "sourceList":[
      {
         "source":"蘋果日報",
         "type":"news",
         "postedAt":"2022-05-17T16:20:00Z",
         "title":"檢方:南加州槍擊案嫌犯周文偉將依謀殺罪起訴 可能面臨死刑",
         "uri":"https://tw.appledaily.com/international/20220518/T6THWU7SEVCKNN3PJ5P6Z65Z3E/",
         "commentCounts":3,
         "authorName":"author name"
      },
      {
         "source":"經濟日報",
         "type":"news",
         "postedAt":"2022-05-17T16:11:15Z",
         "title":"南加州槍擊案嫌犯周文偉 台中一中畢業紀念照曝光",
         "uri":"https://money.udn.com/money/story/replace_by_spider/6320952",
         "commentCounts":3,
         "authorName":"author name"
      }
   ]
}
{
   "count":15,
   "totalResults":171,
   "positionKey":"2022-06-08T10:42:02",
   "sourceList":[
      {
         "source":"ptt",
         "type":"social",
         "postedAt":"2022-06-08T15:41:01Z",
         "title":"[新聞] 籲中央明訂「火化政策」柯:會配合、不搗",
         "uri":"https://www.ptt.cc/bbs/HatePolitics/M.1654702864.A.59A.html",
         "commentCounts":3,
         "authorName":"author name"
      },
      {
         "source":"facebook",
         "type":"social",
         "postedAt":"2022-06-08T14:49:55Z",
         "title":"北市府網軍案疑雲燒不停...",
         "uri":"fblinks",
         "commentCounts":3,
         "authorName":"author name"
      }
   ]
}

4 使用限制

60 requests per minutes per IP