A Python automation tool using Playwright to simulate Pixiv OAuth login, capture authorization code, and exchange it for an access token.
- ✅ Automated Pixiv login (username/password)
- ✅ Console-based code capture
- ✅ Access token & refresh token retrieval
- ✅ Slow typing to bypass bot detection
- ⬜ Supports
headlessand visible mode
git clone https://github.com/piglig/pixiv-token.git
cd pixiv-token
Recommended Python version: >=3.8
pip install -r requirements.txt
playwright install
Sample requirements.txt:
requests==2.32.2
playwright>=1.51.0
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"))
⚠️ Do not hardcode credentials in production environments.- ❌ This is not an official Pixiv SDK.
- 🛡 Please comply with Pixiv's Terms of Service.
See the LICENSE file for license rights and limitations (MIT).
Pull Requests and Issues are welcome!
- GitHub: piglig
- Email: zhu1197437384@gmail.com