leeight / 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 中的例子

Summary

Skyline

image

Circular

支持

下载

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

pip 安装

pip3 install -U 'github_poster[all]'

安装(Python3.6+)

pip3 install -r requirements.txt

使用

生成的 svg 在 OUT_FOLDER 内, 用 type 命名(暂时)

不同类型按下方指定的使用方式:

  • --year 2022: 可以指定年份(默认)或年份区间 --year 2012-2022
  • --track-color=#f4cccc: 指定基础颜色
  • --special-number1 10 -- special_number2 20: 可以指定特殊颜色,默认自动生成不同颜色需要的 number(特殊颜色)
  • --special-color1 pink --special-color2 '#33C6A4': 指定特殊颜色
  • --with-animation: 可以增加动画 (加入 GOGOGO 动画)
  • --animation-time 14: 可以控制动画时间(默认是 10s), 配合 --with-animation 使用
  • --with-skyline: 可以增加 Skyline (默认生成的为 to_year)
  • --skyline-with-name: 将用户名打印在 Skyline 上, 配合 --with-skyline 使用
  • --is-circular: 支持 circular svg 配合动画
  • --without-type-name: 支持隐藏标题中生成类型的名称

其它参数可以见 python3 -m github_poster <type> --help

GPX

Make your GPX GitHub poster

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

python3 -m github_poster gpx --gpx_dir ~/blog/GPX_OUT/ --year 2013-2021
or pip
github_poster gpx --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 strava --strava_client_id  ${client_id} --strava_client_secret ${client_secret} --strava_refresh_token ${refresh_token} --year 2012-2021
or pip
github_poster strava --strava_client_id  ${client_id} --strava_client_secret ${client_secret} --strava_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 --ns_session_token ${session_token} --ns_device_id ${device_id} --year 2020-2021
or pip
github_poster ns --ns_session_token ${session_token} --ns_device_id ${device_id} --year 2020-2021

开心词场

Make your 开心词场 GitHub poster

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

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

多邻国

Make your 多邻国(duolingo) GitHub poster
python3 -m github_poster duolingo --duolingo_user_name ${user_id} --duolingo_password ${user_password} --year 2015-2021
or
github_poster duolingo --duolingo_user_name ${user_id} --duolingo_password ${user_password} --year 2015-2021

扇贝

Make your 扇贝(shanbay) GitHub poster

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

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

不背单词

Make your 不背单词(bbdc) GitHub poster

在设置最下方可以获得 user_id Screenshot_2022-01-15-18-58-00-833_cn com langeas

python3 -m github_poster bbdc --bbdc_user_id ${user_id} --bbdc_type ${time/word}
or
github_poster bbdc --bbdc_user_id ${user_id} --bbdc_type ${time/word}

Issue

Make your Issue GitHub poster

可以参考我的 issue

  1. 确保issue中是有内容的
  2. 内容的第一行必须是数字,因为是取的第一行的数字来进行计数的
python3 -m github_poster issue --issue_number ${issue_number} --repo_name ${repo_name} --github_token ${github_token}
or
github_poster issue --issue_number ${issue_number} --repo_name ${repo_name} --github_token ${github_token}

LeetCode

Make your LeetCode GitHub poster

需要找到你 LeetCodecookie

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

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

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

Twitter

Make your Twitter GitHub poster

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

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

以上方法使用 twint 直接从 Twitter 抓取你的推文数据。

你也可以选择下载 Twitter 存档,并使用 contrib/convert_twitter_archive_to_json_data_source.py 将其转换为 Json 数据源。这一方法尤其适用于以下情况中的一种或多种:

  • 你发过很多推
  • 你使用 Twitter 很多年了
  • 你的网络环境不佳
  • 你是锁推用户

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 --bilibili_cookie "${bilibili-cookie}"
or
github_poster bilibili --bilibili_cookie "${bilibili-cookie}"

GitHub

Make your GitHub GitHub poster

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

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

GitLab

Make your GitLab GitLab poster

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

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

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

python3 -m github_poster gitlab --gitlab_user_name "${gitlab_user_name}" --base_url "https://your-gitlab.com" --session "${gitlab_session}"
or
github_poster gitlab --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 --kindle_cookie ${kindle_cookie} --cn --year 2018-2021
or
github_poster kindle --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 --wakatime_key="your_wakatime_api_key" --year 2019-2021
or
github_poster wakatime --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 --dota2_id="your dota2 id" --year 2017-2018
or
github_poster dota2 --dota2_id="your dota2 id" --year 2017-2018

Nike

Make your Nike poster

获取 Nike 的 refresh_token

  1. 登录 Nike 官网
  2. In Developer -> Application-> Storage -> https:unite.nike.com 中找到 refresh_token
python3 -m github_poster nike --nike_refresh_token="your nike_refresh_token" --year 2012-2021
or
github_poster nike --nike_refresh_token="your nike_refresh_token" --year 2012-2021

Notion

Make your Notion poster

获取 Notion 的 Internal Integration Token(notion_token),查看官方文档获取更多信息。

  1. 登录 Notion 开发者网站
  2. 点击「New integration」添加基础信息后,创建新的 Token
  3. 提交后可以看到 Secrets 下的 Internal Integration Token

获取用于生成 Poster 的 Notion 数据库 ID(database_id),查看官方文档获取更多信息。

  1. 以全屏页面打开数据库
  2. 复制页面链接,链接组成应该是 https://www.notion.so/{workspace_name}/{database_id}?v={view_id} 这样的
  3. 其中 {database_id} 部分即为数据库 ID

注:数据库需要添加一个属性类型为 Date 的日期属性,该属性的值将作为生成 Poster 的日期数据使用。在生成时需将该日期属性的名称作为选项 prop_name 的值,默认值为 Datetime

python3 -m github_poster notion --notion_token="your notion_token" --database_id="your database_id" --prop_name="your prop_name"
or
github_poster notion --notion_token="your notion_token" --database_id="your database_id" --prop_name="your prop_name"

Garmin

Make your Garmin poster

需要填写 Garmin 的账号和密码

python3 -m github_poster garmin --garmin_user_name ${user_name} --garmin_password ${pass_word} --year 2016-2021 --special-color1 blue --special-color2 pink --me yihong0618 --cn
or
github_poster garmin --garmin_user_name ${user_name} --garmin_password ${pass_word} --year 2016-2021 --special-color1 blue --special-color2 pink --me yihong0618 --cn

Forest

Make your Forest GitHub poster

需要填写 Forest 的邮箱账号和密码,如果你转到了**区,需要添加 --cn 参数

python3 -m github_poster forest --forest_email ${user_name} --forest_password ${pass_word} --year 2016-2021 --special-color1 blue --me yihong0618
or
github_poster forest --forest_email ${user_name} --forest_password ${pass_word} --year 2016-2021 --special-color1 blue --me yihong0618

Json

Make your Json(source data) types poster

make sure your json file format is like data.json in examples

python3 -m github_poster json --json_file "your json data file" --year 2019-2021 --me PythonHunter
or
github_poster json --json_file "your json data file" --year 2019-2021 --me PythonHunter

Multiple

Make your Multiple types poster

多个 types 最多支持三个,参数参考上面文档

python3 -m github_poster multiple  --types "github, twitter, strava" --twitter_user_name "twitter user name" --github_user_name "github user name" --strava_client_id  "your strava client id"  --strava_client_secret "your strava client secret"  --strava_refresh_token "your strava refresh token"  --year 2020-2021
or
github_poster multiple  --types "github, twitter, strava" --twitter_user_name "twitter user name" --github_user_name "github user name" --strava_client_id  "your strava client id"  --strava_client_secret "your strava client secret"  --strava_refresh_token "your strava refresh token"  --year 2020-2021

Summary

Make your Summary types poster

多个 types,参数参考上面文档

python3 -m github_poster summary --types "github, twitter, strava" --twitter_user_name "twitter user name" --github_user_name "github user name" --strava_client_id  "your strava client id"  --strava_client_secret "your strava client secret"  --strava_refresh_token "your strava refresh token"  --year 2021
or
github_poster summary --types "github, twitter, strava" --twitter_user_name "twitter user name" --github_user_name "github user name" --strava_client_id  "your strava client id"  --strava_client_secret "your strava client secret"  --strava_refresh_token "your strava refresh token"  --year 2021

即刻

Make your 即刻 (source data) types poster

需要找到你的 Jike (XHR)cookiejike_user_idjike_user_id 可在个人主页的链接中获取: 如https://web.okjike.com/u/82D23B32-CF36-4C59-AD6F-D05E3552CBF382D23B32-CF36-4C59-AD6F-D05E3552CBF3user_id

ps. 只能获取最近一年的数据

可选参数count_type,指定统计类型:

  • record: 动态记录数(默认)
  • like: 动态被点赞数
  • share: 动态被分享数
  • comment: 动态被评论数
  • repost: 动态被转发数
python3 -m github_poster jike --jike_cookie "your jike cookie" --jike_user_id 'your jike user id' --year 2021 --me "your name" --with-animation --animation-time 14 --count_type 'like'
or
github_poster jike --jike_cookie "your jike cookie" --jike_user_id "your jike user id" --year 2021 --me "your name" --with-animation --animation-time 14 --count_type 'like'

微信读书

Make your 微信读书 (source data) types poster

需要获取微信读书网页版的 Cookie

How to:

  • 浏览器打开 https://x.weread.qq.com
  • 微信扫码登录确认,提示没有权限忽略即可
  • 按F12进入开发者模式,依次点 Network -> Doc -> Headers-> cookie。复制 Cookie 字符串;
python3 -m github_poster weread --weread_cookie "your weread cookie" --year 2020-2022 --me "your name"
or
github_poster weread --weread_cookie "your weread cookie" --year 2020-2022 --me "your name"

Covid

Make COVID-19 GitHub poster
python3 -m github_poster covid --covid_area China --year 2020-2022 --me China
or
github_poster covid --covid_area US --year 2020-2022 --me US

参与项目

提交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
  • pypi
  • test
  • English README
  • 如何写 loader 的 doc
  • Refactor some code

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 99.7%Language:Dockerfile 0.3%