DavidZhiXing / GitHubPoster

Make everything a GitHub svg poster and Skyline!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHubPoster

Make everything a GitHub svg poster and skyline!

简体中文 | English

直接引入 svgREADME 中的例子

Skyline

image

支持

下载

git clone https://github.com/yihong0618/GitHubPoster.git

pip 安装

pip3 install -U github_poster

安装(Python3.6+)

pip3 install -r requirements.txt

使用

  • 不同类型按下方指定的使用方式
  • 可以指定年份如 --year 2021, (default) 或年份区间 2012-2021
  • 生成的 svg 在 OUT_FOLDER 内, 用 type 命名(暂时)
  • 默认自动生成不同颜色需要的 number(特殊颜色), 也可以指定如: --special-number1 10 -- special_number2 20
  • 也可以指定颜色: --special-color1 pink --special-color2 '#33C6A4'
  • 其它参数可以见 python3 -m github_poster <type> --help
  • 可以增加动画 --with-animation (加入 GOGOGO 动画), 可以控制动画时间 --animation-time 14(默认是 10s)
  • 可以增加 Skyline --with-skyline (默认生成的为 to_year), 可以使用 --skyline-with-name 将用户名打印在 skyline 上

GPX

Make your GPX GitHub poster

把其它软件生成的(like running_page) gpx files 拷贝到 GPX_FOLDER 之后运行,或指定文件夹如我的文件夹是 ~/blog/GPX_OUT/

python3 -m github_poster gpx --dir ~/blog/GPX_OUT/ --year 2013-2021
or pip
github_poster github_poster gpx --dir ~/blog/GPX_OUT/ --year 2013-2021

Strava

Make your Strava GitHub poster
  1. 注册/登陆 Strava 账号

  2. 登陆成功后打开 Strava Developers -> Create & Manage Your App

  3. 创建 My API Application 输入下列信息: My API Application 创建成功:

  4. 使用以下链接请求所有权限 将 ${your_id} 替换为 My API Application 中的 Client ID 后访问完整链接

https://www.strava.com/oauth/authorize?client_id=${your_id}&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=read_all,profile:read_all,activity:read_all,profile:write,activity:write

get_all_permissions 5. 提取授权后返回链接中的 code 值 例如:

http://localhost/exchange_token?state=&code=1dab37edd9970971fb502c9efdd087f4f3471e6e&scope=read,activity:write,activity:read_all,profile:write,profile:read_all,read_all

code 数值为:

1dab37edd9970971fb502c9efdd087f4f3471e6

get_code 6. 使用 Client_idClient_secretCode 请求 refresch_token终端/iTerm 中执行:

curl -X POST https://www.strava.com/oauth/token \
-F client_id=${Your Client ID} \
-F client_secret=${Your Client Secret} \
-F code=${Your Code} \
-F grant_type=authorization_code

示例:

curl -X POST https://www.strava.com/oauth/token \
-F client_id=12345 \
-F client_secret=b21******d0bfb377998ed1ac3b0 \
-F code=d09******b58abface48003 \
-F grant_type=authorization_code

get_refresch_token

  1. 同步数据至 Strava 在项目根目录执行:
python3 -m github_poster --client_id  ${client_id} --client_secret ${client_secret} --refresh_token ${refresh_token} --year 2012-2021
or pip
github_poster --client_id  ${client_id} --client_secret ${client_secret} --refresh_token ${refresh_token} --year 2012-2021

NS

Make your Nintendo Switch GitHub poster

需要下载 家长控制那个 APP(Nintendo Switch Parent Controls) 进行抓包(可以使用 mitmproxy 等抓包软件)

python3 -m github_poster ns --session_token ${session_token} --device_id ${device_id} --year 2020-2021
or pip
github_poster ns --session_token ${session_token} --device_id ${device_id} --year 2020-2021

开心词场

Make your 开心词场 GitHub poster

需要填写开心词场的账号和密码

python3 -m github_poster cichang --user_name ${user_name} --password ${pass_word} --year 2016-2021 --special-color1 blue --special-color2 pink --me yihong0618
or
github_poster cichang --user_name ${user_name} --password ${pass_word} --year 2016-2021 --special-color1 blue --special-color2 pink --me yihong0618

多邻国

Make your 多邻国(duolingo) GitHub poster

需要找到你的多邻国 id, 从网页抓 xhr 就可以获得如下图 image

python3 -m github_poster duolingo --user_name ${user_id} --year 2015-2021
or
github_poster duolingo --user_name ${user_id} --year 2015-2021

扇贝

Make your 扇贝(shanbay) GitHub poster

需要找到你的扇贝 user_id, 从网页抓 xhr 就可以获得如下图 image

python3 -m github_poster shanbay --user_name ${user_name} --year 2012-2021 --special-color1 '#33C6A4' --special-color2 '#33C6A4'
or
github_poster shanbay --user_name ${user_name} --year 2012-2021 --special-color1 '#33C6A4' --special-color2 '#33C6A4'

Issue

Make your Issue GitHub poster

可以参考我的 issue

python3 -m github_poster issue --issue_number ${issue_number} --repo_name ${repo_name} --token ${github_token}
or
github_poster issue --issue_number ${issue_number} --repo_name ${repo_name} --token ${github_token}

LeetCode

Make your LeetCode GitHub poster

需要找到你 LeetCodecookie

python3 -m github_poster leetcode --cookie ${leetcode_cookie} --year 2019-2021
or
github_poster leetcode --cookie ${leetcode_cookie} --year 2019-2021

如果使用的是 leetcode-cn(leetcode **需要加上参数)--cn

python3 -m github_poster leetcode --cookie ${leetcode_cookie} --year 2019-2021 --cn
or
github_poster leetcode --cookie ${leetcode_cookie} --year 2019-2021 --cn

Twitter

Make your Twitter GitHub poster

需要找到你的 Twitter user_id, 网址里那个就是

python3 -m github_poster twitter --user_name ${user_name} --year 2018-2021 --track-color '#1C9CEA'
or
github_poster twitter --user_name ${user_name} --year 2018-2021 --track-color '#1C9CEA'

Youtube

Make your YouTube GitHub poster

利用 Google 的历史下载下载 YouTube 的历史数据,选择 json 格式,将 watch-history.json 拷贝到 IN-FOLDER 然后运行

python3 -m github_poster youtube --year 2015-2021
or
github_poster youtube --year 2015-2021

Bilibili

Make your Bilibili GitHub poster

需要找到你 Bilibili (XHR)cookie

python3 -m github_poster bilibili --cookie "${bilibili-cookie}"
or
github_poster bilibili --cookie "${bilibili-cookie}"

GitHub

Make your GitHub GitHub poster

需要找到你 GitHub Name (url 后面那个)

python3 -m github_poster github --user_name "${github_user_name}" --with-skyline
or
github_poster github --user_name "${github_user_name}" --with-skyline

GitLab

Make your GitLab GitLab poster

需要找到你 GitLab Name (url 后面那个)

python3 -m github_poster gitlab --user_name "${gitlab_user_name}"
or
github_poster gitlab --user_name "${gitlab_user_name}"

如果是自己搭建的 GitLab,可以指定 GitLab 的 URL,以及登录 GitLab 后得到的 _gitlab_session 这个 cookie(如果需要登录的话)

python3 -m github_poster gitlab --user_name "${gitlab_user_name}" --base_url "https://your-gitlab.com" --session "${gitlab_session}"
or
github_poster gitlab --user_name "${gitlab_user_name}" --base_url "https://your-gitlab.com" --session "${gitlab_session}"

Kindle

Make your Kindle GitHub poster

在亚马逊网站上需要找到你 Amazon-CN (XHR) Cookie

python3 -m github_poster kindle --cookie ${kindle_cookie} --cn --year 2018-2021
or
github_poster kindle --cookie ${kindle_cookie} --cn --year 2018-2021

WakaTime

Make your WakaTime poster

在 WakaTime 官网获取你的 WakaTime API Key:WakaTime API Key

python3 -m github_poster wakatime --key="your_wakatime_api_key" --year 2019-2021
or
github_poster wakatime --key="your_wakatime_api_key" --year 2019-2021

Dota2

Make your Dota2 poster

找到 Dota2 的游戏 ID,例如:Dendi 的 ID 70388657 通过 steam url/username 查询到你的 dota2_id : https://steamid.xyz/ 使用 dota2_id 取得你的游戏数据:https://api.opendota.com/api/players/{dota2_id}/matches. 更多接口信息:https://docs.opendota.com/#section/Introduction"

python3 -m github_poster dota2 --id="your dota2 id" --year 2017-2018
or
github_poster dota2 --id="your dota2 id" --year 2017-2018

参与项目

  • 任何 Issues PR 均欢迎。
  • 可以提交新的 loader

提交PR前:

  • 使用 black 对 Python 代码进行格式化。(black .)
  • 使用 isort 对 Python import 进行格式化。(isort --profile black **/**/*.py )

TODO

  • twitter
  • GitLab
  • GitHub
  • LeetCode
  • GitHub from issues
  • YouTube
  • Bilibili
  • GitHub Actions
  • Change all default color
  • Skyline
  • Dota2
  • 如何写 loader 的 doc
  • pypi
  • test
  • English README

GitHub Actions

  1. fork or clone this repo
  2. 更改需要的 secrets
  3. 更改需要的 type, 多个 type 用逗号分隔

image image

特别感谢

赞赏

谢谢就够了

About

Make everything a GitHub svg poster and Skyline!

License:MIT License


Languages

Language:Python 100.0%