{"id":13446454,"url":"https://github.com/codelucas/newspaper","last_synced_at":"2025-05-12T20:41:11.449Z","repository":{"id":37396843,"uuid":"14681876","full_name":"codelucas/newspaper","owner":"codelucas","description":"newspaper3k is a news, full-text, and article metadata extraction in Python 3. Advanced docs:","archived":false,"fork":false,"pushed_at":"2025-03-07T01:44:47.000Z","size":18319,"stargazers_count":14507,"open_issues_count":501,"forks_count":2124,"subscribers_count":382,"default_branch":"master","last_synced_at":"2025-04-27T23:42:24.851Z","etag":null,"topics":["crawler","crawling","news","news-aggregator","python","scraper"],"latest_commit_sha":null,"homepage":"https://goo.gl/VX41yK","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codelucas.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-11-25T09:50:50.000Z","updated_at":"2025-04-27T15:57:02.000Z","dependencies_parsed_at":"2025-04-08T07:01:49.480Z","dependency_job_id":null,"html_url":"https://github.com/codelucas/newspaper","commit_stats":{"total_commits":533,"total_committers":105,"mean_commits":5.076190476190476,"dds":"0.47467166979362097","last_synced_commit":"f622011177f6c2e95e48d6076561e21c016f08c3"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelucas%2Fnewspaper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelucas%2Fnewspaper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelucas%2Fnewspaper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelucas%2Fnewspaper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelucas","download_url":"https://codeload.github.com/codelucas/newspaper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252527159,"owners_count":21762637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawler","crawling","news","news-aggregator","python","scraper"],"created_at":"2024-07-31T05:00:53.438Z","updated_at":"2025-05-05T15:53:41.728Z","avatar_url":"https://github.com/codelucas.png","language":"HTML","readme":"Newspaper3k: Article scraping \u0026 curation\n========================================\n\n.. image:: https://badge.fury.io/py/newspaper3k.svg\n    :target: http://badge.fury.io/py/newspaper3k.svg\n        :alt: Latest version\n\n.. image:: https://travis-ci.org/codelucas/newspaper.svg\n        :target: http://travis-ci.org/codelucas/newspaper/\n        :alt: Build status\n\n.. image:: https://coveralls.io/repos/github/codelucas/newspaper/badge.svg?branch=master\n        :target: https://coveralls.io/github/codelucas/newspaper\n        :alt: Coverage status\n\n\nInspired by `requests`_ for its simplicity and powered by `lxml`_ for its speed:\n\n    \"Newspaper is an amazing python library for extracting \u0026 curating articles.\"\n    -- `tweeted by`_ Kenneth Reitz, Author of `requests`_\n\n    \"Newspaper delivers Instapaper style article extraction.\" -- `The Changelog`_\n\n.. _`tweeted by`: https://twitter.com/kennethreitz/status/419520678862548992\n.. _`The Changelog`: http://thechangelog.com/newspaper-delivers-instapaper-style-article-extraction/\n\n**Newspaper is a Python3 library**! Or, view our **deprecated and buggy** `Python2 branch`_\n\n.. _`Python2 branch`: https://github.com/codelucas/newspaper/tree/python-2-head\n\nA Glance:\n---------\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e from newspaper import Article\n\n    \u003e\u003e\u003e url = 'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/'\n    \u003e\u003e\u003e article = Article(url)\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e article.download()\n\n    \u003e\u003e\u003e article.html\n    '\u003c!DOCTYPE HTML\u003e\u003chtml itemscope itemtype=\"http://...'\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e article.parse()\n\n    \u003e\u003e\u003e article.authors\n    ['Leigh Ann Caldwell', 'John Honway']\n\n    \u003e\u003e\u003e article.publish_date\n    datetime.datetime(2013, 12, 30, 0, 0)\n\n    \u003e\u003e\u003e article.text\n    'Washington (CNN) -- Not everyone subscribes to a New Year's resolution...'\n\n    \u003e\u003e\u003e article.top_image\n    'http://someCDN.com/blah/blah/blah/file.png'\n\n    \u003e\u003e\u003e article.movies\n    ['http://youtube.com/path/to/link.com', ...]\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e article.nlp()\n\n    \u003e\u003e\u003e article.keywords\n    ['New Years', 'resolution', ...]\n\n    \u003e\u003e\u003e article.summary\n    'The study shows that 93% of people ...'\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e import newspaper\n\n    \u003e\u003e\u003e cnn_paper = newspaper.build('http://cnn.com')\n\n    \u003e\u003e\u003e for article in cnn_paper.articles:\n    \u003e\u003e\u003e     print(article.url)\n    http://www.cnn.com/2013/11/27/justice/tucson-arizona-captive-girls/\n    http://www.cnn.com/2013/12/11/us/texas-teen-dwi-wreck/index.html\n    ...\n\n    \u003e\u003e\u003e for category in cnn_paper.category_urls():\n    \u003e\u003e\u003e     print(category)\n\n    http://lifestyle.cnn.com\n    http://cnn.com/world\n    http://tech.cnn.com\n    ...\n\n    \u003e\u003e\u003e cnn_article = cnn_paper.articles[0]\n    \u003e\u003e\u003e cnn_article.download()\n    \u003e\u003e\u003e cnn_article.parse()\n    \u003e\u003e\u003e cnn_article.nlp()\n    ...\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e from newspaper import fulltext\n\n    \u003e\u003e\u003e html = requests.get(...).text\n    \u003e\u003e\u003e text = fulltext(html)\n\n\nNewspaper can extract and detect languages *seamlessly*.\nIf no language is specified, Newspaper will attempt to auto detect a language.\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e from newspaper import Article\n    \u003e\u003e\u003e url = 'http://www.bbc.co.uk/zhongwen/simp/chinese_news/2012/12/121210_hongkong_politics.shtml'\n\n    \u003e\u003e\u003e a = Article(url, language='zh') # Chinese\n\n    \u003e\u003e\u003e a.download()\n    \u003e\u003e\u003e a.parse()\n\n    \u003e\u003e\u003e print(a.text[:150])\n    香港行政长官梁振英在各方压力下就其大宅的违章建\n    筑（僭建）问题到立法会接受质询，并向香港民众道歉。\n    梁振英在星期二（12月10日）的答问大会开始之际\n    在其演说中道歉，但强调他在违章建筑问题上没有隐瞒的\n    意图和动机。 一些亲北京阵营议员欢迎梁振英道歉，\n    且认为应能获得香港民众接受，但这些议员也质问梁振英有\n\n    \u003e\u003e\u003e print(a.title)\n    港特首梁振英就住宅违建事件道歉\n\n\nIf you are certain that an *entire* news source is in one language, **go ahead and use the same api :)**\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e import newspaper\n    \u003e\u003e\u003e sina_paper = newspaper.build('http://www.sina.com.cn/', language='zh')\n\n    \u003e\u003e\u003e for category in sina_paper.category_urls():\n    \u003e\u003e\u003e     print(category)\n    http://health.sina.com.cn\n    http://eladies.sina.com.cn\n    http://english.sina.com\n    ...\n\n    \u003e\u003e\u003e article = sina_paper.articles[0]\n    \u003e\u003e\u003e article.download()\n    \u003e\u003e\u003e article.parse()\n\n    \u003e\u003e\u003e print(article.text)\n    新浪武汉汽车综合 随着汽车市场的日趋成熟，\n    传统的“集全家之力抱得爱车归”的全额购车模式已然过时，\n    另一种轻松的新兴 车模式――金融购车正逐步成为时下消费者购\n    买爱车最为时尚的消费理念，他们认为，这种新颖的购车\n    模式既能在短期内\n    ...\n\n    \u003e\u003e\u003e print(article.title)\n    两年双免0手续0利率 科鲁兹掀背金融轻松购_武汉车市_武汉汽\n    车网_新浪汽车_新浪网\n\n\n\nEnjoy Newspaper3k? You'll also love BrightData\n----------------------------------------------\n`Click here to see BrightData`_, the premier company offering the internet's most trusted web data. \nThey have AI-powered web scrapers and datasets you may find useful.\n\n.. image:: https://github.com/user-attachments/assets/ca540b8b-7888-49d2-89df-2c07760f6d9f\n        :target: https://get.brightdata.com/hm89s0nowetp\n        :alt: Bright Data's Scraping Browser Product\n\n.. _`Click here to see BrightData`: https://get.brightdata.com/hm89s0nowetp\n\nDocs\n----\n\nCheck out `The Docs`_ for full and detailed guides using newspaper.\n\nInterested in adding a new language for us? Refer to: `Docs - Adding new languages \u003chttps://newspaper.readthedocs.io/en/latest/user_guide/advanced.html#adding-new-languages\u003e`_\n\nFeatures\n--------\n\n- Multi-threaded article download framework\n- News url identification\n- Text extraction from html\n- Top image extraction from html\n- All image extraction from html\n- Keyword extraction from text\n- Summary extraction from text\n- Author extraction from text\n- Google trending terms extraction\n- Works in 10+ languages (English, Chinese, German, Arabic, ...)\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e import newspaper\n    \u003e\u003e\u003e newspaper.languages()\n\n    Your available languages are:\n    input code      full name\n\n      ar              Arabic\n      be              Belarusian\n      bg              Bulgarian\n      da              Danish\n      de              German\n      el              Greek\n      en              English\n      es              Spanish\n      et              Estonian\n      fa              Persian\n      fi              Finnish\n      fr              French\n      he              Hebrew\n      hi              Hindi\n      hr              Croatian\n      hu              Hungarian\n      id              Indonesian\n      it              Italian\n      ja              Japanese\n      ko              Korean\n      lt              Lithuanian\n      mk              Macedonian\n      nb              Norwegian (Bokmål)\n      nl              Dutch\n      no              Norwegian\n      pl              Polish\n      pt              Portuguese\n      ro              Romanian\n      ru              Russian\n      sl              Slovenian\n      sr              Serbian\n      sv              Swedish\n      sw              Swahili\n      th              Thai\n      tr              Turkish\n      uk              Ukrainian\n      vi              Vietnamese\n      zh              Chinese\n\n\nGet it now\n----------\n\nRun ✅ ``pip3 install newspaper3k`` ✅\n\nNOT ⛔ ``pip3 install newspaper`` ⛔\n\nOn python3 you must install ``newspaper3k``, **not** ``newspaper``. ``newspaper`` is our python2 library.\nAlthough installing newspaper is simple with `pip \u003chttp://www.pip-installer.org/\u003e`_, you will\nrun into fixable issues if you are trying to install on ubuntu.\n\n**If you are on Debian / Ubuntu**, install using the following:\n\n- Install ``pip3`` command needed to install ``newspaper3k`` package::\n\n    $ sudo apt-get install python3-pip\n\n- Python development version, needed for Python.h::\n\n    $ sudo apt-get install python-dev\n\n- lxml requirements::\n\n    $ sudo apt-get install libxml2-dev libxslt-dev\n\n- For PIL to recognize .jpg images::\n\n    $ sudo apt-get install libjpeg-dev zlib1g-dev libpng12-dev\n\nNOTE: If you find problem installing ``libpng12-dev``, try installing ``libpng-dev``.\n\n- Download NLP related corpora::\n\n    $ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3\n\n- Install the distribution via pip::\n\n    $ pip3 install newspaper3k\n\n**If you are on OSX**, install using the following, you may use both homebrew or macports:\n\n::\n\n    $ brew install libxml2 libxslt\n\n    $ brew install libtiff libjpeg webp little-cms2\n\n    $ pip3 install newspaper3k\n\n    $ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3\n\n\n**Otherwise**, install with the following:\n\nNOTE: You will still most likely need to install the following libraries via your package manager\n\n- PIL: ``libjpeg-dev`` ``zlib1g-dev`` ``libpng12-dev``\n- lxml: ``libxml2-dev`` ``libxslt-dev``\n- Python Development version: ``python-dev``\n\n::\n\n    $ pip3 install newspaper3k\n\n    $ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3\n\nDonations\n---------\n\nYour donations are greatly appreciated! They will free me up to work on this project more,\nto take on things like: adding new features, bug-fix support, addressing concerns with the library.\n\n- My PayPal link: `https://www.paypal.me/codelucas`_\n- My `Venmo`_ handle: @Lucas-Ou-Yang\n\nDevelopment\n-----------\n\nIf you'd like to contribute and hack on the newspaper project, feel free to clone\na development version of this repository locally::\n\n    git clone git://github.com/codelucas/newspaper.git\n\nOnce you have a copy of the source, you can embed it in your Python package,\nor install it into your site-packages easily::\n\n    $ pip3 install -r requirements.txt\n    $ python3 setup.py install\n\nFeel free to give our testing suite a shot, everything is mocked!::\n\n    $ python3 tests/unit_tests.py\n\nPlanning on tweaking our full-text algorithm? Add the ``fulltext`` parameter::\n\n    $ python3 tests/unit_tests.py fulltext\n\n\nDemo\n----\n\nView a working online demo here: http://newspaper-demo.herokuapp.com\n\nThis is another working online demo: http://newspaper.chinazt.cc/\n\nLICENSE\n-------\n\nAuthored and maintained by `Lucas Ou-Yang`_.\n\n`Parse.ly`_ sponsored some work on newspaper, specifically focused on\nautomatic extraction.\n\nNewspaper uses a lot of `python-goose's`_ parsing code. View their license `here`_.\n\nPlease feel free to `email \u0026 contact me`_ if you run into issues or just would like\nto talk about the future of this library and news extraction in general!\n\n.. _`Lucas Ou-Yang`: http://codelucas.com\n.. _`email \u0026 contact me`: mailto:lucasyangpersonal@gmail.com\n.. _`python-goose's`: https://github.com/grangier/python-goose\n.. _`here`: https://github.com/codelucas/newspaper/blob/master/GOOSE-LICENSE.txt\n\n.. _`https://www.paypal.me/codelucas`: https://www.paypal.me/codelucas\n.. _`Venmo`: https://www.venmo.com/Lucas-Ou-Yang\n\n.. _`Quickstart guide`: https://newspaper.readthedocs.io/en/latest/\n.. _`The Docs`: https://newspaper.readthedocs.io\n.. _`lxml`: http://lxml.de/\n.. _`requests`: https://github.com/kennethreitz/requests\n.. _`Parse.ly`: http://parse.ly\n.. _`It takes only one click`: https://tracking.gitads.io/?campaign=gitads\u0026repo=newspaper\u0026redirect=gitads.io\n","funding_links":["https://www.paypal.me/codelucas"],"categories":["Python","Web Content Extracting","All","HTML","资源列表","Web内容提取","HarmonyOS","scraper","网络","Web Scraping \u0026 Crawling","Web Content Extracting [🔝](#readme)","Data","📚 فهرست","Awesome Python","Uncategorized","Feature Extraction"],"sub_categories":["网页内容提取","Windows Manager","Aggregators","وب اسکرپینگ","Web Content Extracting","Uncategorized","Text/NLP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelucas%2Fnewspaper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelucas%2Fnewspaper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelucas%2Fnewspaper/lists"}