{"id":15725205,"url":"https://github.com/eggplants/get-pixivpy-token","last_synced_at":"2025-04-09T16:18:41.880Z","repository":{"id":37955407,"uuid":"400707520","full_name":"eggplants/get-pixivpy-token","owner":"eggplants","description":"Get your Pixiv token easily (for running upbit/pixivpy)","archived":false,"fork":false,"pushed_at":"2025-04-09T01:57:31.000Z","size":510,"stargazers_count":133,"open_issues_count":2,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T16:18:36.899Z","etag":null,"topics":["api","cli","oauth","pixiv","pixivpy","python","token"],"latest_commit_sha":null,"homepage":"http://egpl.dev/get-pixivpy-token/","language":"Python","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/eggplants.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-08-28T05:11:18.000Z","updated_at":"2025-04-09T01:58:07.000Z","dependencies_parsed_at":"2023-02-19T14:10:56.543Z","dependency_job_id":"2d5938b0-c166-4b2f-af07-aee978bb1a5e","html_url":"https://github.com/eggplants/get-pixivpy-token","commit_stats":{"total_commits":117,"total_committers":4,"mean_commits":29.25,"dds":"0.32478632478632474","last_synced_commit":"331641d78fe15e808b4b2cd9629db942d7150b40"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggplants%2Fget-pixivpy-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggplants%2Fget-pixivpy-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggplants%2Fget-pixivpy-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggplants%2Fget-pixivpy-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggplants","download_url":"https://codeload.github.com/eggplants/get-pixivpy-token/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065281,"owners_count":21041872,"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":["api","cli","oauth","pixiv","pixivpy","python","token"],"created_at":"2024-10-03T22:20:01.887Z","updated_at":"2025-04-09T16:18:41.873Z","avatar_url":"https://github.com/eggplants.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `gppt`: get-pixivpy-token\n\n[![PyPI](\n  \u003chttps://img.shields.io/pypi/v/gppt?color=blue\u003e\n  )](\n  \u003chttps://pypi.org/project/gppt/\u003e\n) [![ghcr](\n  \u003chttps://ghcr-badge.egpl.dev/eggplants/get-pixivpy-token/size\u003e\n  )](\n  \u003chttps://github.com/eggplants/get-pixivpy-token/pkgs/container/get-pixivpy-token\u003e\n) [![Maintainability](\n  \u003chttps://qlty.sh/badges/8be7481b-d978-4e1a-808d-8bbb1984f864/maintainability.svg\u003e\n  )](\n    \u003chttps://qlty.sh/gh/eggplants/projects/get-pixivpy-token\u003e\n) [![pre-commit.ci status](\n  \u003chttps://results.pre-commit.ci/badge/github/eggplants/get-pixivpy-token/main.svg\u003e\n  )](\n  \u003chttps://results.pre-commit.ci/latest/github/eggplants/get-pixivpy-token/main\u003e\n) [![Code Coverage](\n  \u003chttps://qlty.sh/badges/8be7481b-d978-4e1a-808d-8bbb1984f864/test_coverage.svg\u003e\n  )](\n  \u003chttps://qlty.sh/gh/eggplants/projects/get-pixivpy-token\u003e\n)\n\n- Get your Pixiv token (for running [upbit/pixivpy](https://github.com/upbit/pixivpy))\n- Refine [pixiv_auth.py](https://gist.github.com/ZipFile/c9ebedb224406f4f11845ab700124362) + [its fork](https://gist.github.com/upbit/6edda27cb1644e94183291109b8a5fde)\n\n## Install\n\n```bash\npip install gppt\n```\n\n## Enable Proxy\n\nSet `ALL_PROXY` or `HTTPS_PROXY` to your environment variables.\n\n## Run\n\n### Example\n\n```python\nfrom gppt import GetPixivToken\nfrom pixivpy3 import AppPixivAPI\n\ndef get_refresh_token() -\u003e str:\n    with open(\"token.txt\", \"w+\") as f:\n        if refresh_token := f.read().strip():\n            return refresh_token\n\n        g = GetPixivToken(headless=True)\n        refresh_token = g.login(username=\"...\", password=\"...\")[\"refresh_token\"]\n        f.write(refresh_token)\n        return refresh_token\n\naapi = AppPixivAPI()\naapi.auth(refresh_token=get_refresh_token())\n...\n```\n\n### From Docker\n\n```shellsession\n$ docker run --rm -it ghcr.io/eggplants/get-pixivpy-token lh -u \u003cid\u003e -p \u003cpw\u003e\n[+]: Success!\naccess_token: ***\nrefresh_token: ***\nexpires_in: 3600\n```\n\n### From CLI\n\n- Note: _In advance, please setup google-chrome-stable + selenium + webdriver_\n\n```shellsession\n# with browser\n$ gppt login\n[!]: Chrome browser will be launched. Please login.\n(Log in to Pixiv from the login screen that starts up.)\n[+]: Success!\naccess_token: ***\nrefresh_token: ***\nexpires_in: 3600\n...\n\n# with headless browser\n$ gppt login-headless -u \u003cid\u003e -p \u003cpw\u003e\n[!]: Chrome browser will be launched. Please login.\n[+]: Success!\naccess_token: ***\nrefresh_token: ***\nexpires_in: 3600\n```\n\n### From Library\n\n- Note: _In advance, please setup google-chrome-stable + selenium + webdriver_\nIf either username or password are missing, manual input will be required.\n\n```python\nfrom gppt import GetPixivToken\n\ng = GetPixivToken(headless=False,username=None,password=None)\nres = g.login(headless=None,username=None,password=None)\n```\n\n- `res.response` returns:\n\n```json\n{\n  \"access_token\": \"***\",\n  \"expires_in\": 3600,\n  \"refresh_token\": \"***\",\n  \"scope\": \"\",\n  \"token_type\": \"bearer\",\n  \"user\": {\n    \"account\": \"***\",\n    \"id\": \"***\",\n    \"is_mail_authorized\": \u003cbool\u003e,\n    \"is_premium\": \u003cbool\u003e,\n    \"mail_address\": \"***@***\",\n    \"name\": \"***\",\n    \"profile_image_urls\": {\n      \"px_16x16\": \"https://s.pximg.net/common/images/no_profile_ss.png\",\n      \"px_170x170\": \"https://s.pximg.net/common/images/no_profile.png\",\n      \"px_50x50\": \"https://s.pximg.net/common/images/no_profile_s.png\"\n    },\n    \"require_policy_agreement\": \u003cbool\u003e,\n    \"x_restrict\": 2\n  }\n}\n```\n\n## Help\n\n```shellsession\n$ gppt -h\nusage: gppt [-h]\n            {login,l,login-interactive,li,login-headless,lh,refresh,r} ...\n\nGet your Pixiv token (for running upbit/pixivpy)\n\npositional arguments:\n  {login,l,login-interactive,li,login-headless,lh,refresh,r}\n    login (l)           retrieving auth token\n    login-interactive (li)\n                        `login` in interactive mode\n    login-headless (lh)\n                        `login` in headless mode\n    refresh (r)         refresh tokens\n\noptional arguments:\n  -h, --help            show this help message and exit\n```\n\n```shellsession\n$ gppt l -h\nusage: gppt login [-h] [-u USERNAME] [-p PASSWORD] [-j]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -u USERNAME, --username USERNAME\n                        your E-mail address / pixiv ID\n  -p PASSWORD, --password PASSWORD\n                        your current pixiv password\n  -j, --json            output response as json\n```\n\n```shellsession\n$ gppt li -h\nusage: gppt login-interactive [-h] [-j]\n\noptional arguments:\n  -h, --help  show this help message and exit\n  -j, --json  output response as json\n```\n\n```shellsession\n$ gppt lh -h\nusage: gppt login-headless [-h] -u USERNAME -p PASSWORD [-j]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -u USERNAME, --username USERNAME\n                        your E-mail address / pixiv ID\n  -p PASSWORD, --password PASSWORD\n                        your current pixiv password\n  -j, --json            output response as json\n```\n\n```shellsession\n$ gppt r -h\nusage: gppt refresh [-h] [-j] refresh_token\n\npositional arguments:\n  refresh_token\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -j, --json     output response as json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggplants%2Fget-pixivpy-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggplants%2Fget-pixivpy-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggplants%2Fget-pixivpy-token/lists"}