How can i get the news Articles and images?

Hi,

I am using Python to get the News letters.

Here is my code in Python :

headlines = tr.get_news_headlines(query=test+" IN KOREAN",date_from='2023-10-26',date_to='2023-11-28')

for index, headline_row in headlines.iterrows():

story = tr.get_news_story(headline_row['storyId'])

print("story : \n" + str(story))

I was wondering if i could get the thumbnail image with this article.

Best Answer

  • @jwlee08

    I think they are images from top news.

    from refinitiv.data.content import news

    top_news = news.top_news.hierarchy.Definition().get_data();
    #Front Page News
    front_page = news.top_news.Definition(top_news.data.df["topNewsId"][0]).get_data()
    front_page.data.df

    1702538587308.png

    Then, get an image.

    definition = news.images.Definition(front_page.data.df["imageId"][0])
    response = definition.get_data()
    image = response.data.image
    image.show()

Answers