HTML to TEXT style (News story)
Hi
I would like to get news in text in Jupyter Notebook.
But I can get news only in HTML.
How can I get text style news story?
headlines = ek.get_news_headlines('IBM')
for index, headline_row in headlines.iterrows():
story=ek.get_news_story(headline_row['storyId'])
print (story, content-Type: text/html)
Best Answer
-
With Jupyter Notebook, you can use HTML() to display it as HTML.
from IPython.display import HTML
...
headlines = ek.get_news_headlines('IBM')
for index, headline_row in headlines.iterrows(): story=ek.get_news_story(headline_row['storyId'])
HTML(story)1
Answers
-
A Python library is available for this : https://pypi.python.org/pypi/html2text
There is more info here : https://github.com/Alir3z4/html2text/blob/master/docs/usage.md
Simple example with options:
import html2text
...
text_maker = html2text.HTML2Text()
text_maker.ignore_links = True
text_maker.bypass_tables = False
html_story = ek.get_news_story(headline_row['storyId'])
text_story = = text_maker.handle(html_story)
print(text_story)0 -
I could get text based news. Thank you guys for your support.
0 -
It's difficult to identify the precise cause of the HTML formatting not functioning as intended in the absence of precise information regarding recent modifications or updates to the Refinitiv Data Library (RDP) API. Here are some recommendations to assist with troubleshooting the problem, though:
API Documentation Updates:
Check the official documentation for the RDP API to see if there have been any recent updates or changes related to the HTML formatting of news stories. Look for any new parameters or modifications to existing ones.
Support or Release Notes:
Reach out to Refinitiv's support or check their release notes for any announcements regarding changes to the API. They may provide information on updates, bug fixes, or changes in functionality that could impact how news stories are retrieved.
Request Headers:
Ensure that the request headers sent with your API request are correctly configured. Sometimes, changes in the API may require specific headers for the desired response format.
API Version Compatibility:
Make sure the RDP API version you are using and your code are compatible. Your code might need to be modified to function with the most recent version of the API if there have been revisions.
Community or Forums:
Check if there is a developer community or forums related to the Refinitiv Data Library. Other developers may have faced similar issues and could provide insights or solutions.
Logging and Debugging:
Enhance your logging and debugging mechanisms to capture more details about the API response. This can help identify whether the issue is on the API side or within your code.
Contact Refinitiv Support:
If all else fails, consider reaching out directly to Refinitiv's support for assistance. They should be able to provide specific guidance on the issue and any necessary updates to your implementation.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛