Package: article-parser
article-parserExtract article or news by url or html, parse the title and content.English∙简体中文How to installarticle-parseris available on pypihttps://pypi.org/project/article-parser/$ pip install article-parserBasic Usage>>>importarticle_parserarticle_parser.parse(url='',# The URL of the article.html='',# The HTML of the article.threshold=0.9,# The ratio of text to the entire document, default 0.9.output='html',# Result output format, support ``markdown`` and ``html``, default ``html``.**kwargs# Optional arguments that `request` takes. optional),## ouput markdown>>>title,content=article_parser.parse(url="http://www.chinadaily.com.cn/a/202009/22/WS5f6962b2a31024ad0ba7afcb.html",output='markdown',timeout=5)## output html>>>title,content=article_parser.parse(url="http://www.chinadaily.com.cn/a/202009/22/WS5f6962b2a31024ad0ba7afcb.html",timeout=5)ExampleDjokovic wins record 36th Masters title in Rome - Chinadaily.com.cnMarkdown>>>importarticle_parser>>>title,content=article_parser.parse(url="http://www.chinadaily.com.cn/a/202009/22/WS5f6962b2a31024ad0ba7afcb.html",output='markdown',timeout=5)>>>print(title)>>>print('----------------')>>>print(content)Djokovicwinsrecord36thMasterstitleinRome----------------![](http://img2.chinadaily.com.cn/images/202009/22/5f6962b2a31024adbd959228.jpeg)Serbia's Novak Djokovic kisses the trophy after winning the final againstArgentina's Diego Schwartzman at Italian Open, Foro Italico, Rome, Italy, Sept21,2020.[Photo/Agencies]ROME-NovakDjokovicwonarecord36thMasterscrownashebeatDiegoSchwartzmaninthemen's final of the ATP Italian Open on Monday.Djokovic,theworldnumberoneandthetopseedatthetournament,won7-5,6-3againstArgentineSchwartzmantolifthis36thMasterstitle,onemorethanRafaelNadal.TheSerbsaidhedidnotplayhisbesttennisthistimeinRome,butcouldfinditwhenneeded.SimonaHalep,topseedofthewomen's draw, won her first title in Rome afterdefendingchampionKarolinaPliskovaoftheCzechRepublicretiredwhiletrailing6-0,2-1inthefinal.HTML>>>importarticle_parser>>>title,content=article_parser.parse(url="http://www.chinadaily.com.cn/a/202009/22/WS5f6962b2a31024ad0ba7afcb.html",timeout=5)>>>print(title)>>>print('----------------')>>>print(content)Djokovicwinsrecord36thMasterstitleinRome----------------<divid="Content"><figureclass="image"style="display: table;"><imgdata-from="newsroom"id="img-5f6962b2a31024adbd959228"src="//img2.chinadaily.com.cn/images/202009/22/5f6962b2a31024adbd959228.jpeg"/><figcaptionstyle="font-size: 14px; display: table-caption; caption-side: bottom;">Serbia's Novak Djokovic kisses the trophy after winning the final against Argentina'sDiegoSchwartzmanatItalianOpen,ForoItalico,Rome,Italy,Sept21,2020.[Photo/Agencies]</figcaption></figure><pdir="ltr">ROME-NovakDjokovicwonarecord36thMasterscrownashebeatDiegoSchwartzmaninthemen's final of the ATP Italian Open on Monday.</p><pdir="ltr">Djokovic,theworldnumberoneandthetopseedatthetournament,won7-5,6-3againstArgentineSchwartzmantolifthis36thMasterstitle,onemorethanRafaelNadal.</p><pdir="ltr">TheSerbsaidhedidnotplayhisbesttennisthistimeinRome,butcouldfinditwhenneeded.</p><pdir="ltr">SimonaHalep,topseedofthewomen's draw, won her first title in Rome after defending champion Karolina Pliskova of the Czech Republic retired while trailing 6-0, 2-1 in the final.</p></div>Contributors