GitHubPoster

GitHubPoster

多源数据生成GitHub风格SVG活动海报的开源工具

GitHubPoster支持多种数据源和类型,包括Strava运动数据、Nintendo Switch游戏记录、Kindle阅读信息等。用户可以自定义颜色、添加动画效果,轻松生成GitHub风格的SVG活动海报。这个开源工具为数据可视化提供了新的展示方式,适用于展示个人在运动、学习、娱乐等领域的活动轨迹。

GitHubSVG海报生成数据可视化开源项目Github

GitHubPoster

将一切都变为 GitHub svg 海报和 skyline!

简体中文 | English

直接引入 svgREADME 中的例子

摘要

Skyline

image

圆形

支持

下载

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

<details> <summary>制作您的<code>GPX</code> GitHub海报</summary> <br>

把其它软件生成的(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
</details>

Strava

<details> <summary>制作您的<code>Strava</code> GitHub海报</summary>
  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
</details>

NS

<details> <summary>制作您的<code>Nintendo Switch</code> GitHub海报</summary> <br>

需要下载 家长控制那个 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
</details>

开心词场

<details> <summary>制作您的<code>开心词场</code> GitHub海报</summary> <br>

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

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
</details>

多邻国

<details> <summary>制作您的<code>多邻国(duolingo)</code> GitHub海报</summary> <br>
  1. 在浏览器中登录多邻国
  2. 在控制台执行 document.cookie.match(new RegExp('(^| )jwt_token=([^;]+)'))[0].slice(11) 获取 duolingo_jwt
python3 -m github_poster duolingo --duolingo_user_name ${duolingo_user_name} --duolingo_jwt ${duolingo_jwt} --year 2015-2021
或
github_poster duolingo --duolingo_user_name ${duolingo_user_name} --duolingo_duolingo_jwt ${duolingo_jwt} --year 2015-2021

### 扇贝

需要找到你的扇贝 user_id, 从网页抓 xhr 就可以获得如下图
![image](https://yellow-cdn.veclightyear.com/ab5030c0/3d6437d5-e3f9-45cd-9497-fa6c09001ac8.png)

python3 -m github_poster shanbay --shanbay_user_name ${user_name} --year 2012-2021 --special-color1 '#009688' --special-color2 '#007BFF' --track-color '#ADD8E6' 或 github_poster shanbay --shanbay_user_name ${user_name} --year 2012-2021 --special-color1 '#009688' --special-color2 '#007BFF' --track-color '#ADD8E6'


### 不背单词

在设置最下方可以获得 user_id
![Screenshot_2022-01-15-18-58-00-833_cn com langeas](https://yellow-cdn.veclightyear.com/ab5030c0/0bf29e14-4a06-487c-b954-136629df64c9.jpg)


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


### Issue

可以参考我的 [issue](https://github.com/yihong0618/2021/issues/5)
> 1. 确保issue中是有内容的
> 2. 内容的第一行必须是数字,因为是取的第一行的数字来进行计数的

python3 -m github_poster issue --issue_number ${issue_number} --repo_name ${repo_name} --github_token ${github_token} 或 github_poster issue --issue_number ${issue_number} --repo_name ${repo_name} --github_token ${github_token}


### LeetCode

需要找到你 `LeetCode` 的 `cookie`

python3 -m github_poster leetcode --leetcode_cookie ${leetcode_cookie} --year 2019-2021 或 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 或 github_poster leetcode --leetcode_cookie ${leetcode_cookie} --year 2019-2021 --cn


### Youtube

利用 Google 的[历史下载](https://takeout.google.com/settings/takeout)下载 `YouTube` 的历史数据,选择 `json` 格式,将 `watch-history.json` 拷贝到 `IN-FOLDER` 然后运行

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


### Bilibili

需要找到你 `Bilibili (XHR)` 的 `cookie`

python3 -m github_poster bilibili --bilibili_cookie "${bilibili-cookie}" 或 github_poster bilibili --bilibili_cookie "${bilibili-cookie}"


### GitHub

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

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


### GitLab

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

python3 -m github_poster gitlab --gitlab_user_name "${gitlab_user_name}" 或 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}" 或 github_poster gitlab --gitlab_user_name "${gitlab_user_name}" --base_url "https://your-gitlab.com" --session "${gitlab_session}"


### Kindle

在亚马逊网站上需要找到你 [Amazon-CN](https://www.amazon.cn/) (XHR) Cookie

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


### WakaTime

在 WakaTime 官网获取你的 WakaTime API Key:[WakaTime API Key](https://wakatime.com/settings/api-key)

python3 -m github_poster wakatime --wakatime_key="your_wakatime_api_key" --year 2019-2021 或 github_poster wakatime --wakatime_key="your_wakatime_api_key" --year 2019-2021


### Dota2

找到 `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 或 github_poster dota2 --dota2_id="your dota2 id" --year 2017-2018


### Nike

获取 Nike 的 refresh_token

**全部需要在大陆以外的全局 ip 下进行**

![example img](https://yellow-cdn.veclightyear.com/ab5030c0/aaf3ac42-31c6-411d-94d1-175dd7a4fb39.png)

1. 在这里登陆[website](https://unite.nike.com/s3/unite/mobile.html?androidSDKVersion=3.1.0&corsoverride=https%3A%2F%2Funite.nike.com&uxid=com.nike.sport.running.droid.3.8&backendEnvironment=identity&view=login&clientId=VhAeafEGJ6G8e9DxRUz8iE50CZ9MiJMG), 打开 F12 在浏览器抓 login -> XHR -> get the `refresh_token` from login api

2. 复制 `refresh_token`

python3 -m github_poster nike --nike_refresh_token="your nike_refresh_token" --year 2012-2021 或 github_poster nike --nike_refresh_token="your nike_refresh_token" --year 2012-2021


### Notion

获取 Notion 的 `Internal Integration Token`(notion_token),查看[官方文档](https://developers.notion.com/docs/authorization#authorizing-internal-integrations)获取更多信息。

1. 登录 [Notion](https://www.notion.so/my-integrations) 开发者网站
2. 点击「New integration」添加基础信息后,创建新的 Token
3. 提交后可以看到 `Secrets` 下的 `Internal Integration Token`

获取用于生成 Poster 的 Notion 数据库 ID(database_id),查看[官方文档](https://developers.notion.com/docs/working-with-databases#adding-pages-to-a-database)获取更多信息。
  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"
  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"

将ChatGPT官方导出的历史记录中的conversations.json,拷贝到 IN-FOLDER 然后运行(重命名为 chatgpt-history.json)

python3 -m github_poster chatgpt 
or
github_poster chatgpt --me yihong0618

NeoDB

利用 NeoDB 提供的 API,可以方便地制作以标注作为数据的 GitHub Poster。

需要在 NeoDB 的开发者页面获取访问用户信息的 token。

neodb 模块需要两个参数,neodb_token 为获取到的 token,mark_type 对应 NeoDB 上标注的三种分类:complete, wishlist, progress

python3 -m github_poster neodb --neodb_token <token> --mark_type <complete, wishlist, progress, all> --me "your name"

特别地,mark_type 也可以选择 all, 此时会将三种分类的标注都导入。

AutoSleep

导出 AutoSleep 的数据(eg. autosleep.csv)

python3 -m github_poster autosleep --autosleep_file "your csv file" --me "your name"
or
github_poster autosleep --autosleep_file "your csv file" --me "your name"

编辑推荐精选

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

聊天机器人AI助手热门AI工具AI对话
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

热门AI工具AI办公办公工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

模型训练热门AI工具内容创作智能问答AI开发讯飞星火大模型多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

下拉加载更多