Install
-------
Install system requirements for ``lxml``
::
% sudo apt-get install -y libxml2 libxslt1.1 libxml2-dev libxslt1-dev zlib1g-dev
or
% brew install libxml2
Install with ``pip``
::
% pip3 install parse-helper
Optionally install ipython with ``pip3 install ipython`` to enable
``ph-soup-explore`` command
Usage
-----
The ``ph-ddg``, ``ph-download-files``, ``ph-download-file-as``, and
``ph-soup-explore`` scripts are provided
::
$ venv/bin/ph-ddg --help
Usage: ph-ddg [OPTIONS] [QUERY]
Pass a search query to duckduckgo api
Options:
--help Show this message and exit.
$ venv/bin/ph-download-files --help
Usage: ph-download-files [OPTIONS] [ARGS]...
Download all links to local files
- args: urls or filenames containing urls
Options:
--help Show this message and exit.
$ venv/bin/ph-download-file-as --help
Usage: ph-download-file-as [OPTIONS] URL [LOCALFILE]
Download link to local file
- url: a string - localfile: a string
Options:
--help Show this message and exit.
$ venv/bin/ph-soup-explore --help
Usage: ph-soup-explore [OPTIONS] [URL_OR_FILE]
Create a soup object from a url or file and explore with ipython
Options:
--help Show this message and exit.
.. code:: python
In [1]: import parse_helper as ph
In [2]: ph.USER_AGENT
Out[2]: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36'
In [3]: ph.duckduckgo_api('adventure time')
2019-08-27 06:21:05,303: Fetching JSON from https://api.duckduckgo.com?q=adventure+time&format=json
Out[3]:
[{'text': 'Adventure Time An American animated television series created by Pendleton Ward for Cartoon Network.',
'thumbnail': 'https://duckduckgo.com/i/fb8f17fd.png',
'link': 'https://duckduckgo.com/Adventure_Time'},
{'text': '"Adventure Time" (pilot) An animated short created by Pendleton Ward, as well as the pilot to the Cartoon Network series...',
'thumbnail': 'https://duckduckgo.com/i/aa9b49e0.png',
'link': 'https://duckduckgo.com/Adventure_Time_(pilot)'},
{'text': "Adventure Time (1959 TV series) A local children's television show on WTAE-TV 4 in Pittsburgh, Pennsylvania, from 1959 to 1975.",
'thumbnail': '',
'link': 'https://duckduckgo.com/Adventure_Time_(1959_TV_series)'},
{'text': "Adventure Time (1967 TV series) A Canadian children's adventure television series which aired on CBC Television in 1967 and 1968.",
'thumbnail': '',
'link': 'https://duckduckgo.com/Adventure_Time_(1967_TV_series)'},
{'text': 'Adventure Time (album) The second album for the rock/pop trio The Elvis Brothers.',
'thumbnail': '',
'link': 'https://duckduckgo.com/Adventure_Time_(album)'}]
Raw data
{
"_id": null,
"home_page": "https://github.com/kenjyco/parse-helper",
"name": "parse-helper",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "parse,requests,duckduckgo,cli,command-line,download,soup,beautifulsoup,lxml,helper,kenjyco",
"author": "Ken",
"author_email": "kenjyco@gmail.com",
"download_url": "https://github.com/kenjyco/parse-helper/tarball/v0.1.22",
"platform": null,
"description": "Install\n-------\n\nInstall system requirements for ``lxml``\n\n::\n\n % sudo apt-get install -y libxml2 libxslt1.1 libxml2-dev libxslt1-dev zlib1g-dev\n\n or\n\n % brew install libxml2\n\nInstall with ``pip``\n\n::\n\n % pip3 install parse-helper\n\n Optionally install ipython with ``pip3 install ipython`` to enable\n ``ph-soup-explore`` command\n\nUsage\n-----\n\nThe ``ph-ddg``, ``ph-download-files``, ``ph-download-file-as``, and\n``ph-soup-explore`` scripts are provided\n\n::\n\n $ venv/bin/ph-ddg --help\n Usage: ph-ddg [OPTIONS] [QUERY]\n\n Pass a search query to duckduckgo api\n\n Options:\n --help Show this message and exit.\n\n $ venv/bin/ph-download-files --help\n Usage: ph-download-files [OPTIONS] [ARGS]...\n\n Download all links to local files\n\n - args: urls or filenames containing urls\n\n Options:\n --help Show this message and exit.\n\n $ venv/bin/ph-download-file-as --help\n Usage: ph-download-file-as [OPTIONS] URL [LOCALFILE]\n\n Download link to local file\n\n - url: a string - localfile: a string\n\n Options:\n --help Show this message and exit.\n\n $ venv/bin/ph-soup-explore --help\n Usage: ph-soup-explore [OPTIONS] [URL_OR_FILE]\n\n Create a soup object from a url or file and explore with ipython\n\n Options:\n --help Show this message and exit.\n\n.. code:: python\n\n In [1]: import parse_helper as ph\n\n In [2]: ph.USER_AGENT\n Out[2]: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36'\n\n In [3]: ph.duckduckgo_api('adventure time')\n 2019-08-27 06:21:05,303: Fetching JSON from https://api.duckduckgo.com?q=adventure+time&format=json\n Out[3]:\n [{'text': 'Adventure Time An American animated television series created by Pendleton Ward for Cartoon Network.',\n 'thumbnail': 'https://duckduckgo.com/i/fb8f17fd.png',\n 'link': 'https://duckduckgo.com/Adventure_Time'},\n {'text': '\"Adventure Time\" (pilot) An animated short created by Pendleton Ward, as well as the pilot to the Cartoon Network series...',\n 'thumbnail': 'https://duckduckgo.com/i/aa9b49e0.png',\n 'link': 'https://duckduckgo.com/Adventure_Time_(pilot)'},\n {'text': \"Adventure Time (1959 TV series) A local children's television show on WTAE-TV 4 in Pittsburgh, Pennsylvania, from 1959 to 1975.\",\n 'thumbnail': '',\n 'link': 'https://duckduckgo.com/Adventure_Time_(1959_TV_series)'},\n {'text': \"Adventure Time (1967 TV series) A Canadian children's adventure television series which aired on CBC Television in 1967 and 1968.\",\n 'thumbnail': '',\n 'link': 'https://duckduckgo.com/Adventure_Time_(1967_TV_series)'},\n {'text': 'Adventure Time (album) The second album for the rock/pop trio The Elvis Brothers.',\n 'thumbnail': '',\n 'link': 'https://duckduckgo.com/Adventure_Time_(album)'}]\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Helpers to fetch & parse text on pages with requests, lxml, & beautifulsoup4",
"version": "0.1.22",
"project_urls": {
"Download": "https://github.com/kenjyco/parse-helper/tarball/v0.1.22",
"Homepage": "https://github.com/kenjyco/parse-helper"
},
"split_keywords": [
"parse",
"requests",
"duckduckgo",
"cli",
"command-line",
"download",
"soup",
"beautifulsoup",
"lxml",
"helper",
"kenjyco"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "503a9e30fd67ddd8edbde91856ad6ed2d5f2451de8e35593f6e44235910f9eee",
"md5": "a9c99a6314ec02a52cfb15de613e0e48",
"sha256": "f93c71865cc1e3ab8014abd18e7c0f10f3b19107c684d1d50734434acccc26fc"
},
"downloads": -1,
"filename": "parse_helper-0.1.22-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a9c99a6314ec02a52cfb15de613e0e48",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7649,
"upload_time": "2022-04-10T15:48:36",
"upload_time_iso_8601": "2022-04-10T15:48:36.969371Z",
"url": "https://files.pythonhosted.org/packages/50/3a/9e30fd67ddd8edbde91856ad6ed2d5f2451de8e35593f6e44235910f9eee/parse_helper-0.1.22-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-04-10 15:48:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kenjyco",
"github_project": "parse-helper",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "beautifulsoup4",
"specs": []
},
{
"name": "click",
"specs": []
},
{
"name": "fs-helper",
"specs": []
},
{
"name": "input-helper",
"specs": []
},
{
"name": "lxml",
"specs": []
},
{
"name": "requests",
"specs": []
}
],
"lcname": "parse-helper"
}