Get your Pixiv token (for running upbit/pixivpy)

Overview

gppt: get-pixivpy-token

PyPI Docker Image Size (latest by date) Maintainability

Install

❭ pip install gppt

Run

  • Note: In advance, please setup google-chrome-stable + selenium + webdriver
  • On Ubuntu, my setup script is available
❭ ./setup.sh

From Library

from gppt import GetPixivToken
g = GetPixivToken()
res = g.login(headless=True, user="...", pass_="...")
  • res.response returns
{
  "access_token": "***",
  "expires_in": 3600,
  "refresh_token": "***",
  "scope": "",
  "token_type": "bearer",
  "user": {
    "account": "***",
    "id": "***",
    "is_mail_authorized": <bool>,
    "is_premium": <bool>,
    "mail_address": "***@***",
    "name": "***",
    "profile_image_urls": {
      "px_16x16": "https://s.pximg.net/common/images/no_profile_ss.png",
      "px_170x170": "https://s.pximg.net/common/images/no_profile.png",
      "px_50x50": "https://s.pximg.net/common/images/no_profile_s.png"
    },
    "require_policy_agreement": <bool>,
    "x_restrict": 2
  }
}

From CLI

# with browser
❭ gppt login
[!]: Chrome browser will be launched. Please login.
(Log in to Pixiv from the login screen that starts up.)
[+]: Success!
access_token: ***
refresh_token: ***
expires_in: 3600

# with headless browser
❭ gppt login-headless -u <id> -p <pw>
[!]: Chrome browser will be launched. Please login.
[+]: Success!
access_token: ***
refresh_token: ***
expires_in: 3600

From Docker

❭ docker run -it eggplanter/gppt -e PIXIV_ID=<id> -e PIXIV_PASS=<pw>
  • with envfile
# In .env
# PIXIV_ID=<id>
# PIXIV_PASS=<pw>
❭ docker run -it eggplanter/gppt --env-file .env

Help

❭ gppt -h
usage: gppt [-h]
            {login,l,login-interactive,li,login-headless,lh,refresh,r} ...

Get your Pixiv token (for running upbit/pixivpy)

positional arguments:
  {login,l,login-interactive,li,login-headless,lh,refresh,r}
    login (l)           retrieving auth token
    login-interactive (li)
                        `login` in interactive mode
    login-headless (lh)
                        `login` in headless mode
    refresh (r)         refresh tokens

optional arguments:
  -h, --help            show this help message and exit
❭ gppt l -h
usage: gppt login [-h] [-u USERNAME] [-p PASSWORD] [-j]

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        your E-mail address / pixiv ID
  -p PASSWORD, --password PASSWORD
                        your current pixiv password
  -j, --json            output response as json
❭ gppt li -h
usage: gppt login-interactive [-h] [-j]

optional arguments:
  -h, --help  show this help message and exit
  -j, --json  output response as json
❭ gppt lh -h
usage: gppt login-headless [-h] -u USERNAME -p PASSWORD [-j]

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        your E-mail address / pixiv ID
  -p PASSWORD, --password PASSWORD
                        your current pixiv password
  -j, --json            output response as json
❭ gppt r -h
usage: gppt refresh [-h] [-j] refresh_token

positional arguments:
  refresh_token

optional arguments:
  -h, --help     show this help message and exit
  -j, --json     output response as json
Comments
  • There is a login error when reCaptcha occurs

    There is a login error when reCaptcha occurs

    [!]: Chrome browser will be launched. Please login.
    
    DevTools listening on ws://127.0.0.1:50733/devtools/browser/11929e54-0deb-463a-a919-b817c72d6e4b
    [19148:7992:0401/013412.581:ERROR:device_event_log_impl.cc(214)] [01:34:12.581] USB: usb_service_win.cc:354 Could not get child device's service name: 找不到元素。 (0x490)
    [19148:7992:0401/013412.587:ERROR:device_event_log_impl.cc(214)] [01:34:12.588] Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed.
    Traceback (most recent call last):
      File "f:\python3\lib\runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "f:\python3\lib\runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "F:\python3\Scripts\gppt.exe\__main__.py", line 7, in <module>
      File "f:\python3\lib\site-packages\gppt\main.py", line 149, in main
        args.func(args)
      File "f:\python3\lib\site-packages\gppt\main.py", line 44, in func_login
        res = g.login(user=ns.username, pass_=ns.password)
      File "f:\python3\lib\site-packages\gppt\_selenium.py", line 79, in login
        self.__try_login()
      File "f:\python3\lib\site-packages\gppt\_selenium.py", line 163, in __try_login
        raise ValueError("Failed to login")
    ValueError: Failed to login
    
    opened by fatinghenji 9
  • Proxy support and refactor codes

    Proxy support and refactor codes

    Proxy feature will be worked if ALL_PROXY or HTTPS_PROXY is set.


    @narugo1992 Please check.

    pip install git+https://github.com/eggplants/get-pixivpy-token@proxy-support
    
    export ALL_PROXY="..."
    gppt l
    gppt lh -u "..." -p "..."
    
    opened by eggplants 2
  • dev(feat): add proxy support

    dev(feat): add proxy support

    In this PR, I added the following content:

    • System-level proxy (such as export ALL_PROXY=xxx in ~/.bashrc), if there is, start chrome with this proxy
    • User-defined proxy, if the user specifies, use this proxy to start chrome
    • Multi-language recognition support for login buttons (the original code only recognizes the button whose text is Login, so it runs incorrectly in other languages)

    The following tests were performed (in Mainland China):

    • Use system-level proxy (socks5 protocol), run gppt login, it works normally
    • Use system-level proxy, run gppt login-headless, it works normally
    • Use system-level proxy, run through Library, try to get refresh_token and refresh access_token, it works normally
    • Use a custom agent, run through Library, try to get refresh_token and refresh access_token, it works normally
    opened by narugo1992 1
  • Update on PyPI

    Update on PyPI

    The commit d2a2b57a085b2a61e6ac0c52835a405b9ef166de fixes #35, but the PyPI package is still at 2.2.0 and that isn't updated with d2a2b57a085b2a61e6ac0c52835a405b9ef166de, can you update the package on PyPI too?

    Using pip install git+https://github.com/eggplants/get-pixivpy-token@d2a2b57a085b2a61e6ac0c52835a405b9ef166de does work but in some cases like using Poetry in repl.it (poetry add git+https://github.com/eggplants/get-pixivpy-token@d2a2b57a085b2a61e6ac0c52835a405b9ef166de) crashes, and personally i'd prefer an updated release in PyPI since this does fix a minor bug.

    opened by teppyboy 1
  • Update for PixivPy 3.7.2

    Update for PixivPy 3.7.2

    Currently the latest release target PixivPy 3.7.1 so I can't update pixivpy to 3.7.2 in poetry. You should update it to target pixivpy 3.7.2 or consider changing it to "3.7.*" :eyes:

    opened by teppyboy 1
  • build(deps): bump actions/setup-python from 3 to 4

    build(deps): bump actions/setup-python from 3 to 4

    Bumps actions/setup-python from 3 to 4.

    Release notes

    Sourced from actions/setup-python's releases.

    v4.0.0

    What's Changed

    • Support for python-version-file input: #336

    Example of usage:

    - uses: actions/setup-python@v4
      with:
        python-version-file: '.python-version' # Read python version from a file
    - run: python my_script.py
    

    There is no default python version for this setup-python major version, the action requires to specify either python-version input or python-version-file input. If the python-version input is not specified the action will try to read required version from file from python-version-file input.

    • Use pypyX.Y for PyPy python-version input: #349

    Example of usage:

    - uses: actions/setup-python@v4
      with:
        python-version: 'pypy3.9' # pypy-X.Y kept for backward compatibility
    - run: python my_script.py
    
    • RUNNER_TOOL_CACHE environment variable is equal AGENT_TOOLSDIRECTORY: #338

    • Bugfix: create missing pypyX.Y symlinks: #347

    • PKG_CONFIG_PATH environment variable: #400

    • Added python-path output: #405 python-path output contains Python executable path.

    • Updated zeit/ncc to vercel/ncc package: #393

    • Bugfix: fixed output for prerelease version of poetry: #409

    • Made pythonLocation environment variable consistent for Python and PyPy: #418

    • Bugfix for 3.x-dev syntax: #417

    • Other improvements: #318 #396 #384 #387 #388

    Update actions/cache version to 2.0.2

    In scope of this release we updated actions/cache package as the new version contains fixes related to GHES 3.5 (actions/setup-python#382)

    Add "cache-hit" output and fix "python-version" output for PyPy

    This release introduces new output cache-hit (actions/setup-python#373) and fix python-version output for PyPy (actions/setup-python#365)

    The cache-hit output contains boolean value indicating that an exact match was found for the key. It shows that the action uses already existing cache or not. The output is available only if cache is enabled.

    ... (truncated)

    Commits
    • d09bd5e fix: 3.x-dev can install a 3.y version (#417)
    • f72db17 Made env.var pythonLocation consistent for Python and PyPy (#418)
    • 53e1529 add support for python-version-file (#336)
    • 3f82819 Fix output for prerelease version of poetry (#409)
    • 397252c Update zeit/ncc to vercel/ncc (#393)
    • de977ad Merge pull request #412 from vsafonkin/v-vsafonkin/fix-poetry-cache-test
    • 22c6af9 Change PyPy version to rebuild cache
    • 081a3cf Merge pull request #405 from mayeut/interpreter-path
    • ff70656 feature: add a python-path output
    • fff15a2 Use pypyX.Y for PyPy python-version input (#349)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • build(deps): bump pre-commit/action from 2.0.3 to 3.0.0

    build(deps): bump pre-commit/action from 2.0.3 to 3.0.0

    Bumps pre-commit/action from 2.0.3 to 3.0.0.

    Release notes

    Sourced from pre-commit/action's releases.

    pre-commit/[email protected]

    Breaking

    see README for alternatives

    Commits
    • 646c83f v3.0.0
    • 7a7fccb Merge pull request #164 from pre-commit/remove-pushing
    • f5c2d25 remove pushing behaviour
    • c674242 Merge pull request #162 from pre-commit/pre-commit-ci-update-config
    • 8a43c84 [pre-commit.ci] pre-commit autoupdate
    • 0932232 Merge pull request #161 from pre-commit/pre-commit-ci-update-config
    • 3945558 [pre-commit.ci] pre-commit autoupdate
    • d1945e3 Merge pull request #158 from pre-commit/pre-commit-ci-update-config
    • 705d6c1 [pre-commit.ci] pre-commit autoupdate
    • c81293c Merge pull request #156 from pre-commit/pre-commit-ci-update-config
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • Unsupported for python3.7 due to the usage of TypedDict

    Unsupported for python3.7 due to the usage of TypedDict

    As I tested, this code can not be run on python3.7 because of the usage of TypedDict.

    You can see the official documentation here: https://docs.python.org/3/library/typing.html#typing.TypedDict

    The TypedDict is newly added in python3.8.

    So, is there any plan to support python3.7? If not, you should change >=3.7 in setup.cfg to >=3.8

    opened by narugo1992 0
  • Chrome version problem in docker

    Chrome version problem in docker

    I tried the Docker command and it immediately crashed. Is there any workaround?

    Environment: Docker version 20.10.12, build 20.10.12-0ubuntu4

    Stacktrace:

    Traceback (most recent call last):
      File "/usr/local/bin/gppt", line 8, in <module>
        sys.exit(main())
      File "/usr/local/lib/python3.10/site-packages/gppt/main.py", line 148, in main
        args.func(args)
      File "/usr/local/lib/python3.10/site-packages/gppt/main.py", line 57, in func_loginh
        res = g.login(headless=True, user=ns.username, pass_=ns.password)
      File "/usr/local/lib/python3.10/site-packages/gppt/_selenium.py", line 65, in login
        self.driver = webdriver.Chrome(
      File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
        super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
      File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
        super().__init__(
      File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 277, in __init__
        self.start_session(capabilities, browser_profile)
      File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 370, in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
      File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
        self.error_handler.check_response(response)
      File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 107
    Current browser version is 103.0.5060.114 with binary path /usr/bin/google-chrome
    
    opened by potpotkettle 0
Owner
haruna
🎶
haruna
Discord-Token-Formatter - A simple script to convert discord tokens from email token to token only format

Discord-Token-Formatter A simple script to convert discord tokens from email:pas

null 2 Oct 23, 2022
Pixiv 爬虫,使用 Python 实现。支持批量下载、上传到图床。

用 Python 实现的 Pixiv 爬虫,支持批量下载和上传。 随机图片 API: https://loliapi.ml/ Deploy Github Action 集成部署 建议使用本方法部署,相较于本地部署,无需搭建环境,全程在线上完成。并且使用国外服务器下载、上传,网络更加通畅。 Fork

null 18 Feb 26, 2022
Follow pixiv account from twitter profile

Follow pixiv account from twitter profile

Genshi 7 Apr 11, 2022
Discord Token Finder - Find half of your target's token with just their ID.

Discord Token Finder - Find half of your target's token with just their ID.

Ttawi 2 Apr 7, 2022
Get Notified about vaccine availability in your location on email & sms ✉️! Vaccinator Octocat tracks & sends personalised vaccine info everday. Go get your shot ! 💉

Vaccinater Get Notified about vaccine availability in your location on email & sms ✉️ ! Vaccinator Octocat tracks & sends personalised vaccine info ev

Mayukh Pankaj 6 Apr 28, 2022
Buy early bsc gems with custom gas fee, slippage, amount. Auto approve token after buy. Sell buyed token with custom gas fee, slippage, amount. And more.

Pancakeswap Sniper bot Full version of Pancakeswap sniping bot used to snipe during fair coin launches. With advanced options and a graphical user int

Jesus Crypto 204 Apr 27, 2022
DeKrypt 24 Sep 21, 2022
HackZ-Token-Grabber-V2 - HackZ Token Grabber V2

HackZ-Token-Grabber-V2 was made by Love ❌ code ✅ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ??

! ™NightMare 2 Mar 1, 2022
A discord token nuker With loads of options that will screw an account up real bad, also has inbuilt massreport, GroupChat Spammer and Token/Password/Creditcard grabber and so much more!

Installation | Important | Changelogs | Discord NOTE: Hazard is not finished! You can expect bugs, crashes, and non-working functions. Please make an

Rdimo 470 Aug 9, 2022
Want to get your driver's license? Can't get a appointment because of COVID? Well I got a solution for you.

NJDMV-appoitment-alert Want to get your driver's license? Can't get a appointment because of COVID? Well I got a solution for you. We'll get you one i

Harris Spahic 3 Feb 4, 2022
Get-Phone-Number-Details-using-Python - To get the details of any number, we can use an amazing Python module known as phonenumbers.

Get-Phone-Number-Details-using-Python To get the details of any number, we can use an amazing Python module known as phonenumbers. We can use the amaz

Coding Taggers 1 Jan 1, 2022
A bot to get Statistics like the Playercount from your Minecraft-Server on your Discord-Server

Hey Thanks for reading me. Warning: My English is not the best I have programmed this bot to show me statistics about the player numbers and ping of m

spaffel 12 Sep 24, 2022
A website application running in Google app engine, deliver rss news to your kindle. generate mobi using python, multilanguages supported.

Readme of english version refers to Readme_EN.md 简介 这是一个运行在Google App Engine(GAE)上的Kindle个人推送服务应用,生成排版精美的杂志模式mobi/epub格式自动每天推送至您的Kindle或其他邮箱。 此应用目前的主要

null 2.6k Jan 6, 2023
ShadowClone allows you to distribute your long running tasks dynamically across thousands of serverless functions and gives you the results within seconds where it would have taken hours to complete

ShadowClone allows you to distribute your long running tasks dynamically across thousands of serverless functions and gives you the results within seconds where it would have taken hours to complete

null 240 Jan 6, 2023
A simple Telegram bot, written in Python, that you can use to shill (i.e. send messages) your token, or whatever, to channels.

Telegram Shill Bot Ever wanted a Shill Bot but wankers keep scamming for one OR wanted to charge you an arm and a leg? This is a simple bot written in

null 53 Nov 25, 2022
Simple discord token generator good for memberboosting your server! Uses Hcaptcha bypass

discord-tokens-generator INFO This is a Simple Discord Token Generator which creates unverified discord accounts These accounts are good for member bo

Avenger 41 Dec 20, 2022
Discord Token Generator - Python (Generates Tokens and Joins your Server Automatically) hCaptcha Bypass **FREE**

Best Discord Token Generator {hCaptcha bypass FREE Unlimited Memberboost} Install few requirements & run main.py it will redirect you to the Download

null 1 Oct 27, 2021
Discord Token Generator based on HTTPX, makes unverified tokens and automatically joins your server! this is used for memberboosting

Discord Token Generator | 2021 Features: (1) hCaptcha Bypasser, latest hfuck.py Updated by me (2) Free Proxy Support/Scrapper (3) Custom Realistic Dat

null 2 Nov 30, 2021
A simple, fast, and awesome discord nuke bot! The only thing you need to add is your bot token.

SimpleNukeBot A simple, fast, and awesome discord nuke bot! The only thing you need to add is your bot token. Instructions: All you need to do is crea

Bisc 1 Apr 18, 2022