Skip to content

piglig/pixiv-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixiv OAuth Token Fetcher

🌍 English | 简体中文

A Python automation tool using Playwright to simulate Pixiv OAuth login, capture authorization code, and exchange it for an access token.


📦 Features

  • ✅ Automated Pixiv login (username/password)
  • ✅ Console-based code capture
  • ✅ Access token & refresh token retrieval
  • ✅ Slow typing to bypass bot detection
  • ⬜ Supports headless and visible mode

🚀 Installation

1. Clone the repository

git clone https://github.com/piglig/pixiv-token.git
cd pixiv-token

2. Install dependencies

Recommended Python version: >=3.8

pip install -r requirements.txt
playwright install

Sample requirements.txt:

requests==2.32.2
playwright>=1.51.0

⚙️ Usage

Edit and run pixiv_token_fetcher.py:

if __name__ == "__main__":
    fetcher = PixivTokenFetcher(
        username="your_pixiv_email",
        password="your_pixiv_password",
        headless=False
    )
    code = fetcher.fetch_code()
    if code:
        token_info = fetcher.exchange_token(code)
        print("Access Token:", token_info.get("access_token"))
        print("Refresh Token:", token_info.get("refresh_token"))

📌 Notes

  • ⚠️ Do not hardcode credentials in production environments.
  • ❌ This is not an official Pixiv SDK.
  • 🛡 Please comply with Pixiv's Terms of Service.

🧪 Example Output

example


📝 License

See the LICENSE file for license rights and limitations (MIT).


🙋‍♀️ Contribution & Issues

Pull Requests and Issues are welcome!


📫 Contact

About

Playwright-based Pixiv OAuth code & token fetcher

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages