How to retrieve news story via Eikon Data API, if the underlying news is a PDF file
Hi team,
How to retrieve news story via Eikon Data API, if the underlying news is a PDF file? Many thanks.
Regards,
Sunny
Below is python code
---------------------------------------------------------------------------------------------
Ric='3333.HK'
start_date='10/5/2020'
end_date='10/5/2021'
news_headline= ek.get_news_headlines(f'{Ric} HIIS UNAUDITED OPERATING',
date_from=f'{start_date}',
count=100,
date_to=f'{end_date}')
news_body=ek.get_news_story(news_headline['storyId'][2])
news_body
Best Answer
-
According to the response on this thread, this feature is still not available in Eikon Data API.
However, I can get the PDF file with this URL: https://newsfile.refinitiv.com/getnewsfile/v1/story?guid=urn:newsml:reuters.com:20210701:nHKS6BgsFL.
'<div class="storyContent" lang="en"><p>UNAUDITED OPERATING STATISTICS OF PROPERTIES OF THE GROUP FOR JUNE 2021(with URL)</p><p class="line-break"><br/></p><p class="line-break"><br/></p><p class="line-break"><br/></p><p class="line-break"><br/></p><p>Exchange T1 category code 10000:"Announcements and Notices"</p><p class="line-break"><br/></p><p class="line-break"><br/></p><p>Exchange T2 category code 19800:"Other – Trading Update"</p><p class="line-break"><br/></p><p class="line-break"><br/></p><p><a href="reuters://screen/verb=Open/url=cpurl%3A%2F%2Fviews.cp.%2Fnewsfile%2Fgetnewsfile%2Fv1%2Fstory%3Fguid%3Durn%3Anewsml%3Areuters.com%3A20210701%3AnHKS6BgsFL" data-type="cpurl" data-cpurl="cpurl://views.cp./newsfile/getnewsfile/v1/story?guid=urn:newsml:reuters.com:20210701:nHKS6BgsFL" translate="no">http://newsfile.refinitiv.com/getnewsfile/v1/story...</a></p><p class="line-break"><br/></p><p class="line-break"><br/></p><p class="line-break"><br/></p><p>Double click on the URL above to view the article. Please note that internet access is required. If you experience problem accessing the internet, please consult your network administrator or technical support</p><p class="line-break"><br/></p><p class="line-break"><br/></p><p class="line-break"><br/></p><p>Latest version of Adobe Acrobat reader is recommended to view PDF files. The latest version of the reader can be obtained from <a href="http://www.adobe.com/products/acrobat/readstep2.html" data-type="url" class="tr-link" translate="no">http://www.adobe.com/products/acrobat/readstep2.html</a></p></div>';
0
Answers
-
@Jirapongse ,Hi
Thanks for your reply! May I know how to retrieve the link as a whole by using the python code? Since I can see it is separated in the news body.
Thanks,
Danni
0 -
You need to parse the news body to get the link.
For example, you can use the BeautifulSoup library to parse the news body.
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
from bs4 import BeautifulSoup
parsed_html = BeautifulSoup(news_body)
link = parsed_html.body.find('a', attrs={'data-type':'cpurl'})
link_cpurl = link['data-cpurl']
link_text = link.text.split('...')[0] + "?" + link_cpurl.split('?')[1]
link_textThis is just a sample code that may not work for all cases.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛