2016-06-02 3 views
1

Мы форматируем и представляем результаты поиска новостей Alchemy Data News для наших пользователей. Я думаю, что я вижу другие демоверсии, которые это делают (например, Watson News Explorer), и они отображают небольшой отрывок из каждой статьи. Я не вижу никаких отрывков, возвращенных API данных Alchemy Data News. Нам что-то не хватает в нашем запросе? Как мы можем отобразить выдержку новостей для наших пользователей?Алхимия Новости Выдержки

ответ

0

Вы можете извлечь образец текста с помощью возврата = enriched.url.text

Смотрите полный список параметров здесь

https://docs.google.com/spreadsheets/d/1wN0e_fhYCO7GBAneN9xjrNo57OtS_0Tr8FI9xCMfmzM/edit#gid=0

, например

https://gateway-a.watsonplatform.net/calls/data/GetNews?apikey=**** 
    &outputMode=json&start=now-1d&end=now&count=100 
    &q.enriched.url.enrichedTitle.relations.relation 
    =|action.verb.text=acquire,object.entities.entity.type=Company| 
    &return=enriched.url.text 

будет Возврат

{ 
    "status": "OK", 
    "usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html", 
    "totalTransactions": "148", 
    "result": { 
     "docs": [ 
      { 
       "id": "NzI0MTkzMTM0N3wxNDY0OTYzMzY2", 
       "source": { 
        "enriched": { 
         "url": { 
          "text": "We've heard all year that fighting 
          the opioid crisis is the most important issue facing the New Hampshire 
          Legislature. Executive Councilor Colin Van Ostern is required by law to 
          file a report on his gubernatorial campaign's receipts and expenditures by 
          June 22. ..." 
         } 
        } 
       }, 
       "timestamp": 1464963366 
      },(...) 

пс. Я использую API Alchemy для Bluemix

Смежные вопросы