From b5591590a75e1eb79ede0a5262612f6dd41c9ece Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Fri, 20 Dec 2013 23:33:13 -0800 Subject: [PATCH 1/8] finalizing code for upload --- .gitignore | 1 + setup.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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/setup.py b/setup.py index 0a0e734a..73b1f3c2 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 """ @@ -62,11 +64,11 @@ setup( name='newspaper', version='0.0.1', - description='Python article extraction for humans.', + 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.1', #'http://pypi.python.org/pypi/newspaper/', packages=packages, # package_data={'': ['LICENSE'], 'newspaper': []}, # package_dir={'newspaper': 'newspaper'}, From 2491b0d05e72021f1aa8f216e33acb35fd08e36d Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Fri, 20 Dec 2013 23:56:25 -0800 Subject: [PATCH 2/8] finalizing --- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8950b4fd..fa88d8ab 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,14 @@ 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** From fef43ed42d06281ff2db67cf37f14068d842db43 Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Sat, 21 Dec 2013 00:25:26 -0800 Subject: [PATCH 3/8] modified manifest --- MANIFEST.in | 1 + README.rst | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 9ba7a61a..1541ae5c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ recursive-include newspaper * recursive-include tests * +recursive-include * diff --git a/README.rst b/README.rst index fa88d8ab..cae341ed 100644 --- a/README.rst +++ b/README.rst @@ -9,7 +9,6 @@ Newspaper: Article scraping & curation :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. @@ -192,13 +191,11 @@ 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 ------------ @@ -208,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 From bfe91277aad9b8030d7e76da2224969b65c579b0 Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Sat, 21 Dec 2013 00:35:00 -0800 Subject: [PATCH 4/8] trying to fix broken pip --- setup.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 73b1f3c2..68713c86 100644 --- a/setup.py +++ b/setup.py @@ -52,14 +52,23 @@ # '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', From b9b8bd5ae95e552d4665d81f24de008477c7e346 Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Sat, 21 Dec 2013 00:40:36 -0800 Subject: [PATCH 5/8] trying to fix broken pip dist --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 1541ae5c..e4223112 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ recursive-include newspaper * recursive-include tests * -recursive-include * +recursive-include . * From fd256eb2d4cacbd20a3d74d38a8688bda27df4e3 Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Sat, 21 Dec 2013 01:18:30 -0800 Subject: [PATCH 6/8] fixing dist --- README.rst | 4 ++-- setup.py | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index cae341ed..58f63338 100644 --- a/README.rst +++ b/README.rst @@ -187,13 +187,13 @@ Get it now $ pip install newspaper Examples TODO --------- +------------- See more examples at the `Quickstart guide`_. Documentation TODO -------------- +------------------ Full documentation is available at `Quickstart guide`_. diff --git a/setup.py b/setup.py index 68713c86..8c431e51 100644 --- a/setup.py +++ b/setup.py @@ -55,20 +55,17 @@ try: with open('README.rst') as f: readme = f.read() -except: - readme = u'' +except: readme = u'' try: with open('LICENSE') as f: license = f.read() -except: - license = u'' +except: license = u'' try: with open('HISTORY.md') as f: history = f.read() -except: - history = u'' +except: history = u'' setup( name='newspaper', From 8090ca6e46ed3b238382d2bb08edc7f1f9faa7e2 Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Sat, 21 Dec 2013 01:27:35 -0800 Subject: [PATCH 7/8] fixed summary bug in article --- newspaper/nlp.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) 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') From 06b2fc913d8d9aa97dd31cd829a8b847c5a7d17a Mon Sep 17 00:00:00 2001 From: Lucas Ou-Yang Date: Sat, 21 Dec 2013 01:59:03 -0800 Subject: [PATCH 8/8] fixing manifest --- MANIFEST.in | 2 +- setup.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index e4223112..015ec3a0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ recursive-include newspaper * recursive-include tests * -recursive-include . * +include README.rst LICENSE AUTHORS.md CHANGES.txt HISTORY.md diff --git a/setup.py b/setup.py index 8c431e51..d306de71 100644 --- a/setup.py +++ b/setup.py @@ -69,12 +69,12 @@ setup( name='newspaper', - version='0.0.1', + 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='https://github.com/codelucas/newspaper/tarball/0.0.1', #'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'}, @@ -83,3 +83,8 @@ license=license, zip_safe=False, ) + +import nltk +nltk.download('stopwords') +nltk.download('punkt') +