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/[email protected]
    
    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/[email protected] does work but in some cases like using Poetry in repl.it (poetry add git+https://github.com/eggplants/[email protected]) 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/[email protected]
      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/[email protected]
      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
Robust and blazing fast open-redirect vulnerability scanner with ability of recursevely crawling all of web-forms, entry points, or links with data.

After Golismero project got dead there is no more any up to date open-source tool that can collect links with parametrs and web-forms and then test th

railway zeppelin 34 Aug 25, 2022
Python Discord Server Nuker

Untitled Nuker Python Discord Server Nuker Features: Ban Everyone Kick Everyone Rename Everyone Spam To All Channels Delete All Channels Delete All Ro

22 Dec 22, 2022
Discord Bot for League of Legends live match tracker

SABot Dicord Bot for League of Legends match auto tracker Features: Search Summoners statistics in League of Legends. Auto-notifications provide when

Jungyu Choi 4 Sep 27, 2022
Source code for Profile REST API

PROJECT PROFILE REST API Creating local development server: We will create a local development server that can run and test our API as we build it. We

1 Mar 29, 2022
Easily report Instagram pages and close the page

Program Features - 📌 Delete target post on Instagram. - 📌 Delete Media Target post on Instagram - 📌 Complete deletion of the target account on Inst

hack4lx 11 Nov 25, 2022
Track player's stats, find out when they're online and grinding!

Hypixel Stats Tracker Track player's stats, find out when they're online and playing games! INFO Showcase Server: https://discord.gg/yY5qQHPar6 Suppor

4 Dec 18, 2022
A discord token nuker With loads of options that will screw an account up real bad

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!

XPTGR 0 Aug 07, 2022
CSUL Discord Bot

Cruzeiro This is the same old bot running on the Discord Server of CSUL, but i've changed the code. It's better now. Discord.py Heroku How i did The b

Operaho 6 Jan 31, 2022
❄️ Don't waste your money paying for new tokens, once you have used your tokens, clean them up and resell them!

TokenCleaner Don't waste your money paying for new tokens, once you have used your tokens, clean them up and resell them! If you have a very large qua

0xVichy 59 Nov 14, 2022
Just a python library to make reddit post caching easier

Reddist Just a python library to make reddit post caching easier. Caching Options In Memory Caching Redis Caching Pickle Caching Usage Installation: D

Samrid Pandit 3 Jan 16, 2022
This is a simple bot for running Python code through Discord

Python Code Runner Discord Bot This is a simple bot for running Python code through Discord. It was originally developed for the Beginner.Codes Discor

beginner.py 1 Feb 14, 2022
股票量化

StockQuant Gary-Hertel 请勿提交issue!可以加入交流群与其他朋友一起自学交流,加微信mzjimmy 一、配置文件的设置 启动框架需要先导入必要的模块,并且载入一次配置文件! 配置文件是一个json格式的文件config.json,在docs文件夹中有模板

218 Dec 25, 2022
Telegram Group Calls Streaming bot with some useful features, written in Python with Pyrogram and Py-Tgcalls. Supporting platforms like Youtube, Spotify, Resso, AppleMusic, Soundcloud and M3u8 Links.

Yukki Music Bot Yukki Music Bot is a Powerful Telegram Music+Video Bot written in Python using Pyrogram and Py-Tgcalls by which you can stream songs,

Team Yukki 996 Dec 28, 2022
Transcript-Extractor-Bot - Yet another Telegram Voice Recognition bot but using vosk and supports 20+ languages

transcript extractor Yet another Telegram Voice Recognition bot but using vosk a

6 Oct 21, 2022
A Powerful, Smart And Simple Userbot In Pyrogram.

Eagle-USERBOT 🇮🇳 A Powerful, Smart And Simple Userbot In Pyrogram. Support 🚑 Inspiration & Credits Userge-X Userge Pokurt Pyrogram Code Owners Mast

Masterolic 1 Nov 28, 2021
A multi-password‌ cracking tool that can help you hack facebook accounts very quickly

FbCracker This is a multi-password‌ cracking tool that can help you hack facebook accounts very quickly. Facebook Hacking Tool Installation On Termux

ReD H4CkeR 9 Nov 16, 2022
Python script to Funge NFTs.

Python script to Funge NFTs. It scrapes OpenSea for a given list of NFT collections and downloads a certain number of NFTs from each collection or the entire collections.

3 Apr 28, 2022
procedurally-generated catppuccin wallpapers

Catppuccin Wallpapers I was in need of wallpapers conforming to the catppuccin colorscheme. So, I wrote a simple script to iteratively generate a set

daylin 11 Nov 29, 2022
Python client for the Socrata Open Data API

sodapy sodapy is a python client for the Socrata Open Data API. Installation You can install with pip install sodapy. If you want to install from sour

Cristina 368 Dec 09, 2022
Bot simply search for the files from provided channel according to given query and gives link to those files as buttons!

Auto Filter Bot ㅤㅤㅤㅤㅤㅤㅤ ㅤㅤㅤㅤㅤㅤㅤ You can call this as an Auto Filter Bot if you like :D Bot simply search for the files from provided channel according

TroJanzHEX 89 Nov 23, 2022