GitHubPoster - Make everything a GitHub svg poster

Overview

GitHubPoster

Make everything a GitHub svg poster

image

支持

下载

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

安装(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'
  • 其它参数可以见 cli.py

GPX

Make your GPX GitHub poster

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

python3 cli.py --type 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_id、Client_secret、Code 请求 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 cli.py --type strava --strava_client_id  ${client_id} --strava_client_secret ${client_secret} --strava_refresh_token ${client_secret} --year 2012-2021}

NS

Make your Nintendo Switch GitHub poster

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

python3 cli.py --type ns --ns_session_token ${session_token} --ns_device_id ${device_id} --year 2020-2021

开心词场

Make your 开心词场 GitHub poster

需要下载开心词场的账号和密码

python3 cli.py --type 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

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

python3 cli.py --type duolingo --duolingo_user_name ${user_id} --year 2015-2021

扇贝

Make your 扇贝(shanbay) GitHub poster

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

python3 cli.py --type shanbay --shanbay_user_name ${user_name} --year 2012-2021 --special-color1 '#33C6A4' --special-color2 '#33C6A4'

Issue

Make your Issue GitHub poster

可以参考我的 issue

python3 cli.py --type issue --github_issue_number ${issue_number} --github_repo_name ${repo_name} --github_token ${github_token}

参与项目

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

提交PR前:

  • 使用 black 对 Python 代码进行格式化。

TODO

  • twitter
  • gitlab
  • GitHub
  • LeetCode
  • GitHub from issues
  • Steam
  • PS
  • Podcast
  • 如何写 loader 的 doc
  • pypi
  • GitHub Actions
  • English README

GitHub Actions

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

image image

特别感谢

赞赏

谢谢就够了

Comments
  • generating duolingo poster failed

    generating duolingo poster failed

    I met this error when generating poster for duolingo

    image

    File "/home/<user>/GitHubPoster/loader/base_loader.py", line 29, in <listcomp>
    month_list = [m for m in month_list if m < pendulum.now()]  
    
    ValueError: Posix spec does not match last transition     
    

    I think we need to check if the timezone matches?

    opened by dexhunter 27
  • [py38 + mac] OSError: cannot open resource 😭

    [py38 + mac] OSError: cannot open resource 😭

    Traceback (most recent call last):
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/bin/github_poster", line 8, in <module>
        sys.exit(main())
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/github_poster/cli.py", line 118, in main
        s.make_skyline()
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/github_poster/skyline/skyline.py", line 115, in make_skyline
        skyline_info_card = self._make_skyline_card(text_info)
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/github_poster/skyline/skyline.py", line 76, in _make_skyline_card
        w, h = measure_text(FONT, TEXT)
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/sdf/text.py", line 19, in measure_text
        font = ImageFont.truetype(name, 96)
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/PIL/ImageFont.py", line 855, in truetype
        return freetype(font)
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/PIL/ImageFont.py", line 852, in freetype
        return FreeTypeFont(font, size, index, encoding, layout_engine)
      File "/Users/xxxxxxxxx/opt/miniconda3/envs/py38/lib/python3.8/site-packages/PIL/ImageFont.py", line 211, in __init__
        self.font = core.getfont(
    OSError: cannot open resource
    
    opened by RRRoger 9
  • Add feature: WakaTime

    Add feature: WakaTime

    Hi, there.

    I just add the WakaTime feature for this repo.

    Here is a example:

    wakatime

    I'm not so familiar with this project honestly speaking.

    So i just use the second to calculate the counts, maybe your can change it later.

    Here a typical json item is json result:

    {
          "categories": [],
          "dependencies": [],
          "editors": [],
          "grand_total": {
            "digital": "0:00",
            "hours": 0,
            "minutes": 0,
            "text": "0 secs",
            "total_seconds": 0
          },
          "languages": [],
          "machines": [],
          "operating_systems": [],
          "projects": [],
          "range": {
            "date": "2020-01-01",
            "end": "2020-01-01T15:59:59Z",
            "start": "2019-12-31T16:00:00Z",
            "text": "Wed Jan 1st 2020",
            "timezone": "Asia/Shanghai"
          }
    }
    

    I use item["range"]["date"] for date, and item["grand_total"]["total_seconds"] for value.

    opened by JasonkayZK 7
  • Lazy importing each loaders's dependencies

    Lazy importing each loaders's dependencies

    随着支持的 loader 越来越多,每个 loader 可能会有自己的依赖,导致整个项目的依赖越来越多,但是很多用户实际上并不会用到所有的 loader,导致了一些不必要的依赖安装。

    这个 PR 在不做大的重构的条件下,

    1. 将各个 loader 的依赖放到了独立的 extras_require 中,比如想使用 twitter loader,就需要 pip install github_poster[twitter]。默认情况下也提供了 github_poster[all] 来简化一些小白用户的使用。
    2. 将 loader 的依赖 import 延迟到了真正要使用的时候。为需要额外加载依赖的 loader 提供了 try_import_deps 方法,在使用真正的功能前尝试加载它的依赖,如果 import 失败,抛出异常,提示用户需要安装额外的依赖。
    opened by j178 6
  • make jikeloader can specify statistics type

    make jikeloader can specify statistics type

    Option argument count_type, you can specify statistics type:

    • record: post num (default)
    • like: post be liked num
    • share: post be share num
    • comment: post be comment num
    • repost: post be repost num
    opened by umm233 5
  • [feature] Generate Wakatime poster?

    [feature] Generate Wakatime poster?

    Greatest poster generator ever!

    WakaTime is a widget that can be embedded into lots of IDEs to track coding time.

    Here is a report page demo:

    WakaTime report

    And the corresponding API Doc:

    So i'm wondering if there is any chances generating the WakaTime's poster?

    Thanks a lot!

    opened by JasonkayZK 5
  • win10 python3

    win10 python3

    Traceback (most recent call last): File "F:\github\GitHubPoster\cli.py", line 11, in from loader import ( File "F:\github\GitHubPoster\loader_init_.py", line 5, in from .github_loader import GitHubLoader File "F:\github\GitHubPoster\loader\github_loader.py", line 1, in from parser import GitHubParser ImportError: cannot import name 'GitHubParser' from 'parser' (unknown location)

    opened by netoearth 5
  • Add script to convert Twitter Archive to JSON data source

    Add script to convert Twitter Archive to JSON data source

    Currently GitHubPoster only supports scraping Twitter data directly from Twitter.com. This process is time-consuming and error-prone due to, for instance, network limits.

    If one has a lot of tweets that span a long range of time, it makes more sense to download a Twitter Archive and use that as the data source.

    This PR adds a simple script that converts the Twitter Archive into a simple JSON file that can be fed into GitHubPoster's JSON loader.

    opened by wzyboy 4
  • Add Dockerfile

    Add Dockerfile

    usage

    build

    docker build -t github_poster .
    

    run

    docker run --rm -v $(pwd)/OUT_FOLDER:/app/OUT_FOLDER github_poster duolingo --duolingo_user_name xxxxx --duolingo_password yyyyy --me whoami
    

    The arguments after image_name (here is github_poster) will pass to python scripts directly.

    opened by deanwong 3
  • feat: add notion loader

    feat: add notion loader

    Add Notion Loader.

    Use your Notion as a CMS, get data from Notion database to generate poster.

    • notion_token: The Notion internal integration token, see here for more detail.
    • database_id: The Notion database id, you can learn from Where can I find my database's ID?
    • prop_name: The Notion database property name which stored the date and time, an ISO 8601 format date, with optional time.

    NOTE

    The prop_name property should be set as Date property type, or the loader won't work properly.

    Property Type Date


    A Notion template as example:

    Example

    opened by ruter 3
  • Refactor: use subcommands to group CLI options

    Refactor: use subcommands to group CLI options

    • 使用子命令对命令行参数进行分组、隔离
    • 由于第一条改动,命令行参数去除type名称前缀,不会有歧义
    • 同样由于第一条改动,现在在适当的命令行参数上加上required=True限制
    • 将loader相关参数收拢到loader类中,替代type字典
    • --is-cn 更名为 --cn
    • 合并youtube的两个参数为一个
    • 更新README中说明

    Close #19

    opened by frostming 3
Releases(1.0)
Owner
yihong
The best is yet to come
yihong
UNMAINTAINED! Renders beautiful SVG maps in Python.

Kartograph is not maintained anymore As you probably already guessed from the commit history in this repo, Kartograph.py is not maintained, which mean

null 1k Dec 9, 2022
Python package that generates hardware pinout diagrams as SVG images

PinOut A Python package that generates hardware pinout diagrams as SVG images. The package is designed to be quite flexible and works well for general

null 336 Dec 20, 2022
Generate visualizations of GitHub user and repository statistics using GitHub Actions.

GitHub Stats Visualization Generate visualizations of GitHub user and repository statistics using GitHub Actions. This project is currently a work-in-

JoelImgu 3 Dec 14, 2022
Generate visualizations of GitHub user and repository statistics using GitHub Actions.

GitHub Stats Visualization Generate visualizations of GitHub user and repository statistics using GitHub Actions. This project is currently a work-in-

Aditya Thakekar 1 Jan 11, 2022
🧇 Make Waffle Charts in Python.

PyWaffle PyWaffle is an open source, MIT-licensed Python package for plotting waffle charts. It provides a Figure constructor class Waffle, which coul

Guangyang Li 528 Jan 2, 2023
🧇 Make Waffle Charts in Python.

PyWaffle PyWaffle is an open source, MIT-licensed Python package for plotting waffle charts. It provides a Figure constructor class Waffle, which coul

Guangyang Li 397 Feb 17, 2021
Make sankey, alluvial and sankey bump plots in ggplot

The goal of ggsankey is to make beautiful sankey, alluvial and sankey bump plots in ggplot2

David Sjoberg 156 Jan 3, 2023
Make your BSC transaction simple.

bsc_trade_history Make your BSC transaction simple. 中文ReadMe Background: inspired by debank ,Practice my hands on this small project Blog:Crypto-BscTr

foolisheddy 7 Jul 6, 2022
Make visual music sheets for thatskygame (graphical representations of the Sky keyboard)

sky-python-music-sheet-maker This program lets you make visual music sheets for Sky: Children of the Light. It will ask you a few questions, and does

null 21 Aug 26, 2022
Make scripted visualizations in blender

Scripted visualizations in blender The goal of this project is to script 3D scientific visualizations using blender. To achieve this, we aim to bring

Praneeth Namburi 10 Jun 1, 2022
I'm doing Genuary, an aritifiacilly generated month to build code that make beautiful things

Genuary 2022 I'm doing Genuary, an aritifiacilly generated month to build code that make beautiful things. Every day there is a new prompt for making

Joaquín Feltes 1 Jan 10, 2022
A simple script that displays pixel-based animation on GitHub Activity

GitHub Activity Animator This project contains a simple Javascript snippet that produces an animation on your GitHub activity tracker. The project als

null 16 Nov 15, 2021
paintable GitHub contribute table

githeart paintable github contribute table how to use: Functions key color select 1,2,3,4,5 clear c drawing mode mode on turn off e print paint matrix

Bahadır Araz 27 Nov 24, 2022
GitHub Stats Visualizations : Transparent

GitHub Stats Visualizations : Transparent Generate visualizations of GitHub user and repository statistics using GitHub Actions. ⚠️ Disclaimer The pro

YuanYap 7 Apr 5, 2022
An easy to use burndown chart generator for GitHub Project Boards.

Burndown Chart for GitHub Projects An easy to use burndown chart generator for GitHub Project Boards. Table of Contents Features Installation Assumpti

Joseph Hale 15 Dec 28, 2022
GitHub English Top Charts

Help you discover excellent English projects and get rid of the interference of other spoken language.

kon9chunkit 529 Jan 2, 2023
Python script for writing text on github contribution chart.

Github Contribution Drawer Python script for writing text on github contribution chart. Requirements Python 3.X Getting Started Create repository Put

Steven 0 May 27, 2022
Tweets your monthly GitHub Contributions as Wordle grid

Tweets your monthly GitHub Contributions as Wordle grid

Venu Vardhan Reddy Tekula 5 Feb 16, 2022
Visualise top-rated GitHub repositories in a barchart by keyword

This python script was written for simple purpose -- to visualise top-rated GitHub repositories in a barchart by keyword. Script generates html-page with barchart and information about repository owner, description, create date and update date.

Cur1iosity 2 Feb 7, 2022