pagesaver


Namepagesaver JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/ZhaoQi99/PageSaver
SummaryArchive your web page.
upload_time2024-08-14 03:37:04
maintainerNone
docs_urlNone
authorQi Zhao
requires_python>=3.8
licenseNone
keywords archiving web archiving playwright backup
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PageSaver 
[![Python version](https://img.shields.io/pypi/pyversions/pagesaver.svg?logo=python)](https://pypi.python.org/pypi/pagesaver)
[![PyPI package](https://img.shields.io/pypi/v/pagesaver.svg)](https://pypi.python.org/pypi/pagesaver)
[![PyPI download](https://img.shields.io/pypi/dm/pagesaver.svg)](https://pypi.python.org/pypi/pagesaver)
[![GitHub](https://img.shields.io/github/license/ZhaoQi99/pagesaver)](https://github.com/ZhaoQi99/pagesaver/blob/main/LICENSE)
![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/ZhaoQi99/pagesaver)

Archive your web page.

## Requirements
* Python >= 3.8

## Install
<details open>
<summary><img height="15" src="https://www.python.org/favicon.ico"></img> pip</summary>

```shell
pip install pagesaver
✨🍰✨
```
Or you can use `pip install git+https://github.com/ZhaoQi99/PageSaver.git
` install latest version.
</details>

<details>
<summary><img height="15" src="https://cdn.simpleicons.org/docker/338FED?viewbox=auto" /> docker</summary>

```shell
docker run -d --name pagesaver -p 8001:8001 zhaoqi99/pagesaver
```

</details>

## Quick Start
### HTTP API
1. Init PageSaver: `pagesaver init`
2. Start HTTP Server: `pagesaver server`
    > `nohup pagesaver server >> server.log 2>&1 &`
3. Examples:
```shell
~$ curl http://127.0.0.1:8001/api/record/https://www.baidu.com/?format=MHTML&format=PDF -H 'Authorization: <API_TOKEN>'
~$ curl http://127.0.0.1:8001/api/record/notion/https://www.baidu.com/?format=MHTML&format=PDF&api_token=api_token&database_id=1&token_v2=token_v2&title=test -H 'Authorization: <API_TOKEN>'
```

### CLI 
```shell
pagesaver export https://www.baidu.com -o . -f MHTML,PDF
```

## HTTP Usage
### Authorization
Using the Authorization header, format is: `Authorization: <API_TOKEN>`

### Record API
* GET `api/record/{url}?format=MHTML&format=PDF`
#### Query Params

| Parameter | Type   | Required | Description                                           |
| --------- | ------ | -------- | ----------------------------------------------------- |
| format    | string | No       | Storage format, can be MHTML or PDF, defaults to all. |

### Notion Push API
* GET `api/record/notion/{url}?format=MHTML&format=PDF&api_token=<NOTION_API_TOKEN>&database_id=<NOTION_DATABASE_ID>&token_v2=<NOTION_TOKEN_V2>&title=test`
* [Notion API Token](https://www.notion.so/profile/integrations)
* Notion Token V2: F12 -> Application -> Cookies -> token_v2
* Database ID: https://www.notion.so/{USERNAME}/{DATABASE_ID}
* Connection with: Notion ->Top right corner -> More -> Connections -> Connect to -> Your Integration

### Automations
<a href="https://www.icloud.com/shortcuts/2917f0c4c8a94654978d6b70cb5d84c0">
  <img src="https://help.apple.com/assets/645D5D228BE0233D28263F4B/645D5D258BE0233D28263F5A/zh_CN/d230a25cb974f8908871af04caad89a1.png" height="50" alt="IOS Shortcut" />
</a>


#### Query Params

| Parameter    | Type   | Required | Description                                                                                    |
| ------------ | ------ | -------- | ---------------------------------------------------------------------------------------------- |
| format       | string | No       | Storage format, can be MHTML or PDF, defaults to all.                                          |
| api_token*   | string | Yes      | Notion API Token                                                                               |
| database_id* | string | Yes      | Notion Database ID                                                                             |
| title        | string | No       | Title stored in Notion.                                                                        |
| token_v2     | string | No       | Obtained from Browser->Cookies->token_v2.To store files in Notion, this parameter is required. |

## CLI Usage
### Export
```shell
~$ pagesaver export -h
Usage: pagesaver export [OPTIONS] URL

  Export page to the output file

Options:
  -f, --format [MHTML,PDF]  Format which you want to export  [required]
  -o, --output DIRECTORY    Output directory of the file  [required]
  -n, --name TEXT           Name of the exported file  [default: exported]
  -h, --help                Show this message and exit.
```
### Server
```shell
~$ pagesaver init
~$ pagesaver server -h
Usage: pagesaver server [OPTIONS]

  Run PageSaver HTTP server

Options:
  -h, --help       Show this message and exit.
  -b, --bind TEXT  The TCP host/address to bind to.  [default: 0.0.0.0:8001]
```

## Configuration
PageSaver will read the configuration from `config.py` automatically.

### STORAGE
* type: storage type. Currently supported values are "local".
* path: path of storage.This is only used when type is set to "local".

### SERVER_BIND
The TCP host/address to bind to.

Default: `0.0.0.0:8001`

### TITLE_PROPERTY
The property name in Notion to use for the title of a page.

Default: `title`

### LINK_PROPERTY
The property name in Notion to use for the link of a page.

Default: `link`

### MHTML_PROPERTY
The property name in Notion to use for the MHTML file of a page.

Default: `mhtml`

## License
[GNU General Public License v3.0](https://github.com/ZhaoQi99/PageSaver/blob/main/LICENSE)

## Author
* Qi Zhao([zhaoqi99@outlook.com](mailto:zhaoqi99@outlook.com))

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ZhaoQi99/PageSaver",
    "name": "pagesaver",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "archiving, web archiving, playwright, backup",
    "author": "Qi Zhao",
    "author_email": "zhaoqi99@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/d6/c6/fb384f68553962e33315e2231cb7b4a87660ac2ae6e855b29932785aca4b/pagesaver-0.1.0.tar.gz",
    "platform": null,
    "description": "# PageSaver \n[![Python version](https://img.shields.io/pypi/pyversions/pagesaver.svg?logo=python)](https://pypi.python.org/pypi/pagesaver)\n[![PyPI package](https://img.shields.io/pypi/v/pagesaver.svg)](https://pypi.python.org/pypi/pagesaver)\n[![PyPI download](https://img.shields.io/pypi/dm/pagesaver.svg)](https://pypi.python.org/pypi/pagesaver)\n[![GitHub](https://img.shields.io/github/license/ZhaoQi99/pagesaver)](https://github.com/ZhaoQi99/pagesaver/blob/main/LICENSE)\n![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/ZhaoQi99/pagesaver)\n\nArchive your web page.\n\n## Requirements\n* Python >= 3.8\n\n## Install\n<details open>\n<summary><img height=\"15\" src=\"https://www.python.org/favicon.ico\"></img> pip</summary>\n\n```shell\npip install pagesaver\n\u2728\ud83c\udf70\u2728\n```\nOr you can use `pip install git+https://github.com/ZhaoQi99/PageSaver.git\n` install latest version.\n</details>\n\n<details>\n<summary><img height=\"15\" src=\"https://cdn.simpleicons.org/docker/338FED?viewbox=auto\" /> docker</summary>\n\n```shell\ndocker run -d --name pagesaver -p 8001:8001 zhaoqi99/pagesaver\n```\n\n</details>\n\n## Quick Start\n### HTTP API\n1. Init PageSaver: `pagesaver init`\n2. Start HTTP Server: `pagesaver server`\n    > `nohup pagesaver server >> server.log 2>&1 &`\n3. Examples:\n```shell\n~$ curl http://127.0.0.1:8001/api/record/https://www.baidu.com/?format=MHTML&format=PDF -H 'Authorization: <API_TOKEN>'\n~$ curl http://127.0.0.1:8001/api/record/notion/https://www.baidu.com/?format=MHTML&format=PDF&api_token=api_token&database_id=1&token_v2=token_v2&title=test -H 'Authorization: <API_TOKEN>'\n```\n\n### CLI \n```shell\npagesaver export https://www.baidu.com -o . -f MHTML,PDF\n```\n\n## HTTP Usage\n### Authorization\nUsing the Authorization header, format is: `Authorization: <API_TOKEN>`\n\n### Record API\n* GET `api/record/{url}?format=MHTML&format=PDF`\n#### Query Params\n\n| Parameter | Type   | Required | Description                                           |\n| --------- | ------ | -------- | ----------------------------------------------------- |\n| format    | string | No       | Storage format, can be MHTML or PDF, defaults to all. |\n\n### Notion Push API\n* GET `api/record/notion/{url}?format=MHTML&format=PDF&api_token=<NOTION_API_TOKEN>&database_id=<NOTION_DATABASE_ID>&token_v2=<NOTION_TOKEN_V2>&title=test`\n* [Notion API Token](https://www.notion.so/profile/integrations)\n* Notion Token V2: F12 -> Application -> Cookies -> token_v2\n* Database ID: https://www.notion.so/{USERNAME}/{DATABASE_ID}\n* Connection with: Notion ->Top right corner -> More -> Connections -> Connect to -> Your Integration\n\n### Automations\n<a href=\"https://www.icloud.com/shortcuts/2917f0c4c8a94654978d6b70cb5d84c0\">\n  <img src=\"https://help.apple.com/assets/645D5D228BE0233D28263F4B/645D5D258BE0233D28263F5A/zh_CN/d230a25cb974f8908871af04caad89a1.png\" height=\"50\" alt=\"IOS Shortcut\" />\n</a>\n\n\n#### Query Params\n\n| Parameter    | Type   | Required | Description                                                                                    |\n| ------------ | ------ | -------- | ---------------------------------------------------------------------------------------------- |\n| format       | string | No       | Storage format, can be MHTML or PDF, defaults to all.                                          |\n| api_token*   | string | Yes      | Notion API Token                                                                               |\n| database_id* | string | Yes      | Notion Database ID                                                                             |\n| title        | string | No       | Title stored in Notion.                                                                        |\n| token_v2     | string | No       | Obtained from Browser->Cookies->token_v2.To store files in Notion, this parameter is required. |\n\n## CLI Usage\n### Export\n```shell\n~$ pagesaver export -h\nUsage: pagesaver export [OPTIONS] URL\n\n  Export page to the output file\n\nOptions:\n  -f, --format [MHTML,PDF]  Format which you want to export  [required]\n  -o, --output DIRECTORY    Output directory of the file  [required]\n  -n, --name TEXT           Name of the exported file  [default: exported]\n  -h, --help                Show this message and exit.\n```\n### Server\n```shell\n~$ pagesaver init\n~$ pagesaver server -h\nUsage: pagesaver server [OPTIONS]\n\n  Run PageSaver HTTP server\n\nOptions:\n  -h, --help       Show this message and exit.\n  -b, --bind TEXT  The TCP host/address to bind to.  [default: 0.0.0.0:8001]\n```\n\n## Configuration\nPageSaver will read the configuration from `config.py` automatically.\n\n### STORAGE\n* type: storage type. Currently supported values are \"local\".\n* path: path of storage.This is only used when type is set to \"local\".\n\n### SERVER_BIND\nThe TCP host/address to bind to.\n\nDefault: `0.0.0.0:8001`\n\n### TITLE_PROPERTY\nThe property name in Notion to use for the title of a page.\n\nDefault: `title`\n\n### LINK_PROPERTY\nThe property name in Notion to use for the link of a page.\n\nDefault: `link`\n\n### MHTML_PROPERTY\nThe property name in Notion to use for the MHTML file of a page.\n\nDefault: `mhtml`\n\n## License\n[GNU General Public License v3.0](https://github.com/ZhaoQi99/PageSaver/blob/main/LICENSE)\n\n## Author\n* Qi Zhao([zhaoqi99@outlook.com](mailto:zhaoqi99@outlook.com))\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Archive your web page.",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://github.com/ZhaoQi99/PageSaver/releases",
        "Homepage": "https://github.com/ZhaoQi99/PageSaver",
        "Issue Tracker": "https://github.com/ZhaoQi99/PageSaver/issues",
        "Source": "https://github.com/ZhaoQi99/PageSaver"
    },
    "split_keywords": [
        "archiving",
        " web archiving",
        " playwright",
        " backup"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "adf69164f5b2d7747e4c81bc3337c83c79c45136e79f9bd3562e5b1211fbe7b8",
                "md5": "c7bc7aacbb751e033f994a1005ae8a29",
                "sha256": "ab76e6ddaec0dc04f35f27727e301d4de7b3d92e74e3cc77faac18c06429a540"
            },
            "downloads": -1,
            "filename": "pagesaver-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c7bc7aacbb751e033f994a1005ae8a29",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 38492,
            "upload_time": "2024-08-14T03:37:02",
            "upload_time_iso_8601": "2024-08-14T03:37:02.082959Z",
            "url": "https://files.pythonhosted.org/packages/ad/f6/9164f5b2d7747e4c81bc3337c83c79c45136e79f9bd3562e5b1211fbe7b8/pagesaver-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6c6fb384f68553962e33315e2231cb7b4a87660ac2ae6e855b29932785aca4b",
                "md5": "887805299d61987df5bc5ef15df26975",
                "sha256": "0c05c9d0192761a2850439f455be8e594ef8cafd618201b800bd8b28de2dd790"
            },
            "downloads": -1,
            "filename": "pagesaver-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "887805299d61987df5bc5ef15df26975",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 31780,
            "upload_time": "2024-08-14T03:37:04",
            "upload_time_iso_8601": "2024-08-14T03:37:04.650421Z",
            "url": "https://files.pythonhosted.org/packages/d6/c6/fb384f68553962e33315e2231cb7b4a87660ac2ae6e855b29932785aca4b/pagesaver-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-14 03:37:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ZhaoQi99",
    "github_project": "PageSaver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pagesaver"
}
        
Elapsed time: 0.42442s