ld.news.get_headlines

Hi DevPortal, good afternoon. May I ask for your help.

I use python library to fetch news by ld.news.get_headlines('Elon musk', count=10), while it return error: LDError: Error code 400 | Query cannot return any result. Is there any format for query in this function?

Kindly pls provide me a sample script on how to do this as well in codebook.

Thank you.

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @RALPHPAOLO.NAVARRO

    Thank you for reaching out to us.

    Please try this one:

    ld.news.get_headlines("'Elon musk'", count=10)
    
    image.png
  • @Jirapongse Thank you. was able to share it with the client. :)

  • @Jirapongse please help with client followup :

    Thank you for your help. I would also like to know if I were to filter the headlines to be 'X' (formerly known as twitter), am I suppose to use this: 

    ld.news.get_headlines("'Elon musk' AND Source:'X'", count=10)? It seems like it returns nothing back, could you check whether this is the correct code?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    Please check this discussion.