diff --git a/.gitignore b/.gitignore index 186c6942..ed7c0ada 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store .idea +.pypirc # C extensions *.so diff --git a/MANIFEST.in b/MANIFEST.in index 9ba7a61a..015ec3a0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ recursive-include newspaper * recursive-include tests * +include README.rst LICENSE AUTHORS.md CHANGES.txt HISTORY.md diff --git a/README.rst b/README.rst index 8950b4fd..58f63338 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,15 @@ Newspaper: Article scraping & curation ====================================== +.. image:: https://badge.fury.io/py/newspaper.png + :target: http://badge.fury.io/py/newspaper + :alt: Latest version + .. image:: https://pypip.in/d/newspaper/badge.png :target: https://crate.io/packages/newspaper/ :alt: Number of PyPI downloads -Homepage: `https://newspaper.readthedocs.org/ `_ - Inspired by ``requests`` for its simplicity and powered by ``lxml`` for its speed; **newspaper** is a Python 2 library for extracting & curating articles from the web. @@ -185,17 +187,15 @@ Get it now $ pip install newspaper Examples TODO --------- +------------- See more examples at the `Quickstart guide`_. -.. _`Quickstart guide`: https://newspaper.readthedocs.org/en/latest/quickstart.html#quickstart - Documentation TODO -------------- +------------------ -Full documentation is available at https://newspaper.readthedocs.org/. +Full documentation is available at `Quickstart guide`_. Requirements ------------ @@ -205,6 +205,8 @@ Requirements License ------- -MIT licensed. See the bundled `LICENSE `_ file for more details. +MIT licensed. Also, view the LICENSE for our internally used libraries at: `goose-license`_ + .. _`goose-license`: https://github.com/codelucas/newspaper/tree/master/newspaper/packages/python-goose-documents +.. _`Quickstart guide`: https://newspaper.readthedocs.org/en/latest/quickstart.html#quickstart diff --git a/newspaper/nlp.py b/newspaper/nlp.py index 160bc906..4a237224 100644 --- a/newspaper/nlp.py +++ b/newspaper/nlp.py @@ -14,21 +14,8 @@ def summarize(url='', title='', text=''): """""" - article = None - - if title == '' or text == '': - return None - - a_title, a_text = '', '' - if article is not None: - a_title = article.title - a_text = article.cleaned_text - - text = a_text or text - title = a_title or title - if (text == '' or title == ''): - return None + return [] if isinstance(title, unicode): title = title.encode('utf-8', 'ignore') diff --git a/setup.py b/setup.py index 0a0e734a..d306de71 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,8 @@ #!/bin/python2.7 """ +Lucas Ou-Yang 2014 -- http://codelucas.com + Setup guide: http://guide.python-distribute.org/creation.html """ @@ -50,23 +52,29 @@ # 'nltk', # 'requests==2.0.1', -with open('README.rst') as f: - readme = f.read() +try: + with open('README.rst') as f: + readme = f.read() +except: readme = u'' -with open('LICENSE') as f: - license = f.read() +try: + with open('LICENSE') as f: + license = f.read() +except: license = u'' -with open('HISTORY.md') as f: - history = f.read() +try: + with open('HISTORY.md') as f: + history = f.read() +except: history = u'' setup( name='newspaper', - version='0.0.1', - description='Python article extraction for humans.', + version='0.0.2', + description='Simplified python article discovery & extraction.', long_description=readme + '\r\n' + history, author='Lucas Ou-Yang', author_email='lucasyangpersonal@gmail.com', - url='http://pypi.python.org/pypi/newspaper/', + url='https://github.com/codelucas/newspaper/tarball/0.0.2', packages=packages, # package_data={'': ['LICENSE'], 'newspaper': []}, # package_dir={'newspaper': 'newspaper'}, @@ -75,3 +83,8 @@ license=license, zip_safe=False, ) + +import nltk +nltk.download('stopwords') +nltk.download('punkt') +