Skip to main content

Simplified python article discovery & extraction.

Project description

Inspired by requests for its simplicity and powered by lxml for its speed:

“Newspaper is an amazing python library for extracting & curating articles.” – tweeted by Kenneth Reitz, Author of requests

“Newspaper delivers Instapaper style article extraction.” – The Changelog

We support 10+ languages and everything is in unicode!

>>> import newspaper
>>> newspaper.languages()

Your available languages are:
input code      full name

  ar              Arabic
  ru              Russian
  nl              Dutch
  de              German
  en              English
  es              Spanish
  fr              French
  it              Italian
  ko              Korean
  no              Norwegian
  pt              Portuguese
  sv              Swedish
  hu              Hungarian
  fi              Finnish
  da              Danish
  zh              Chinese
  id              Indonesian
  vi              Vietnamese

A Glance:

>>> import newspaper

>>> cnn_paper ='')

>>> for article in cnn_paper.articles:
>>>     print article.url

>>> for category in cnn_paper.category_urls():
>>>     print category

>>> article = cnn_paper.articles[0]

>>> article.html
u'<!DOCTYPE HTML><html itemscope itemtype="http://...'
>>> article.parse()

>>> article.authors
[u'Leigh Ann Caldwell', 'John Honway']

>>> article.text
u'Washington (CNN) -- Not everyone subscribes to a New Year's resolution...'

>>> article.top_image

>>> article.movies
[u'', ...]
>>> article.nlp()

>>> article.keywords
['New Years', 'resolution', ...]

>>> article.summary
u'The study shows that 93% of people ...'

Newspaper has seamless language extraction and detection. If no language is specified, Newspaper will attempt to auto detect a language.

>>> from newspaper import Article
>>> url = ''

>>> a = Article(url, language='zh') # Chinese

>>> a.parse()

>>> print a.text[:150]
意图和动机。 一些亲北京阵营议员欢迎梁振英道歉,

>>> print a.title

If you are certain that an entire news source is in one language, go ahead and use the same api :)

>>> import newspaper
>>> sina_paper ='', language='zh')

>>> for category in sina_paper.category_urls():
>>>     print category

>>> article = sina_paper.articles[0]
>>> article.parse()

>>> print article.text
新浪武汉汽车综合 随着汽车市场的日趋成熟,
另一种轻松的新兴 车模式――金融购车正逐步成为时下消费者购

>>> print article.title
两年双免0手续0利率 科鲁兹掀背金融轻松购_武汉车市_武汉汽


Check out The Documentation for full and detailed guides using newspaper.

Interested in adding a new language for us? Refer to: Docs - Adding new languages


  • Works in 10+ languages (English, Chinese, German, Arabic, …)
  • Multi-threaded article download framework
  • News url identification
  • Text extraction from html
  • Top image extraction from html
  • All image extraction from html
  • Keyword extraction from text
  • Summary extraction from text
  • Author extraction from text
  • Google trending terms extraction

Get it now

Installing newspaper is simple with pip. However, you will run into fixable issues if you are trying to install on ubuntu.

If you are on ubuntu, install using the following:

# Pre-req's for lxml
$ apt-get install libxml2-dev libxslt-dev

# For PIL to recognize .jpg
$ sudo apt-get install libjpeg-dev zlib1g-dev libpng12-dev

$ easy_install lxml # NOT PIP

$ pip install newspaper

$ curl | python2.7

If you are on OSX, install using the following:

# Pre-req's for lxml
$ brew install libxml2 libxslt # or the equiv command in macports

$ pip install lxml

# For PIL to recognize .jpg
$ brew install libtiff libjpeg webp little-cms2 # or the equiv with macports

$ pip install newspaper

$ curl | python2.7

If you are neither using ubuntu nor mac, install with the following:

# You will most likely need to install the following libraries via your
# package manager
# for lxml: libxml2-dev libxslt-dev
# for PIL: libjpeg-dev zlib1g-dev libpng12-dev

$ pip install newspaper

$ curl | python2.7

It is also important to note that the line

$ curl | python2.7

is not needed unless you need the natural language, nlp(), features like keywords extraction and summarization.

If you are using ubuntu and are still running into gcc compile errors when installing lxml, try installing libxslt1-dev instead of libxslt-dev.

Todo List

  • Add a “follow_robots.txt” option in the config object.
  • Bake in the CSSSelect and BeautifulSoup dependencies


Authored and maintained by Lucas Ou-Yang.

Newspaper uses a lot of python-goose’s parsing code. View their license here.

Please feel free to email & contact me if you run into issues or just would like to talk about the future of this library and news extraction in general!

Project details

Release history Release notifications

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node

History Node


History Node


This version
History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
newspaper-0.0.7.macosx-10.8-intel.exe (7.2 MB) Copy SHA256 hash SHA256 Windows Installer any Jun 17, 2014
newspaper-0.0.7.tar.gz (6.9 MB) Copy SHA256 hash SHA256 Source None Jun 17, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page