Download the PHP package 2dareis2do/newspaper3k-php-wrapper without Composer

On this page you can find all versions of the php package 2dareis2do/newspaper3k-php-wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package newspaper3k-php-wrapper

Newspaper3k PHP Wrapper

Packagist Version

Simple php wrapper for Newspaper3/4k Article scraping and curation.

Now updated to add support for changing the current working directory, enabling you to customise your curation script per job.

Update

2.1.0 introduces an additional parameter for a client to pass command parameter. This is useful where multiple versions of python (with respective dependencies) may be available on a single server. If no value is passed, it will default to the use the default python string. This supports both absolute or relative paths.

Customising ArticleScraping.py

This script is designed to use a modified version of the ArticleScraping script. e.g. Here is an custom example of ArticleScraping.py that utilises a Playwright wrapper. This can be utilised by passing the cwd parameter:

Using Newspaper3kWrapper

In this shortened example we simply pass the current working directory to the Newspaper3kWrapper.

Alternative Article Scraping Script

The path to ArticleScraping.py can be changed by passing the cwd. Here is an example that uses the Cloudscraper library.

Features

Install dependencies

Run ✅ pip3 install newspaper3k

NOT ⛔ pip3 install newspaper

On python3 you must install newspaper3k, not newspaper. newspaper is our python2 library. Although installing newspaper is simple with pip <http://www.pip-installer.org/>_, you will run into fixable issues if you are trying to install on ubuntu.

If you are on Debian / Ubuntu, install using the following:

NOTE: If you find problem installing libpng12-dev, try installing libpng-dev.

If you are on OSX, install using the following, you may use both homebrew or macports:

::

$ brew install libxml2 libxslt

$ brew install libtiff libjpeg webp little-cms2

$ pip3 install newspaper3k

$ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3

Otherwise, install with the following:

NOTE: You will still most likely need to install the following libraries via your package manager

::

$ pip3 install newspaper3k

$ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3

Install on venv

The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories. A virtual environment is created on top of an existing Python installation, known as the virtual environment’s “base” Python, and may optionally be isolated from the packages in the base environment, so only those explicitly installed in the virtual environment are available. Python

also,

A common directory location for a virtual environment is .venv. This name keeps the directory typically hidden in your shell and thus out of the way while giving it a name that explains why the directory exists. It also prevents clashing with .env environment variable definition files that some tooling supports.

Bearing this in mind here this is the recommended way to install your dependencies:

  1. If installing for the first time you may need to make sure pip is enabled. On ubuntu 22.x first update apt e.g. apt update then install apt install python3-pip

  2. If installing for the first time you may also need to make sure venv is available. On ubuntu 22.x it can be downloaded like so apt install python3-venv

  3. Decide where you want to set up you venv. This can be somehwere on your virtual host. You can use the following syntax: python -m venv /path/to/new/virtual/.venv

  4. Activate your .venv in your current session. e.g. source /path/to/new/virtual/.venv/bin/activate

  5. The first time you set up your script you will likely need to download and install any necessary dependencies. You can use pip to help with this form your Virtual session. Once you have installed your dependencies, you can export a list to use for subsequent installs e.g. python -m pip freeze > /path/to/requirements.txt

  6. Exit your virtual environment. e.g. deactivate

Subsequent installs

The next time you have to set up your dependencies, you can now start using pip to install them automatically. e.g. python -m pip install -r /path/to/requirements.txt

Running on the server

Chances are you web server does not run a virtual environment session. However, we can still specify the path to python in our newly created virtual environment folder and python will automatically load your installed dependencies (unlike the global server version). e.g. We can pass the absolute path to the version of python we want to use by passing the following $command parameter: /path/to/python/.venv/bin/python

This can also be passed relatively which can be more robust across different environments. e.g. ../relative/path/to/python/.venv/bin/python

If we do not a path for $command, it will default to use the globally installed verion of python.

Installation

1 time download of the sentence tokenizer

After installing the NLTK package, please do install the necessary datasets/models for specific functions to work.

In particular you will need the Punkt Sentence Tokenizer.

e.g.

loads python interpreter:

or

Note that 'all' would be a few gigabytes so bear this in mind (Installing can quickly eat up any root partition disk space).

Usage

Read more

Newspaper

nltk

Scrape & Summarize News Articles Using Python


All versions of newspaper3k-php-wrapper with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
symfony/process Version >=6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 2dareis2do/newspaper3k-php-wrapper contains the following files

Loading the files please wait ...