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
A Python package for caclulations and visualizations in geological sciences.

geo_calcs A Python package for caclulations and visualizations in geological sciences. Free software: MIT license Documentation: https://geo-calcs.rea

Drew Heasman 1 Jul 12, 2022
Flame Graphs visualize profiled code

Flame Graphs visualize profiled code

Brendan Gregg 14.1k Jan 03, 2023
An interactive GUI for WhiteboxTools in a Jupyter-based environment

whiteboxgui An interactive GUI for WhiteboxTools in a Jupyter-based environment GitHub repo: https://github.com/giswqs/whiteboxgui Documentation: http

Qiusheng Wu 105 Dec 15, 2022
Render Jupyter notebook in the terminal

jut - JUpyter notebook Terminal viewer. The command line tool view the IPython/Jupyter notebook in the terminal. Install pip install jut Usage $jut --

Kracekumar 169 Dec 27, 2022
Fast visualization of radar_scenes based on oleschum/radar_scenes

RadarScenes Tools About This python package provides fast visualization for the RadarScenes dataset. The Open GL based visualizer is smoother than ole

Henrik Söderlund 2 Dec 09, 2021
With Holoviews, your data visualizes itself.

HoloViews Stop plotting your data - annotate your data and let it visualize itself. HoloViews is an open-source Python library designed to make data a

HoloViz 2.3k Jan 04, 2023
An intuitive library to add plotting functionality to scikit-learn objects.

Welcome to Scikit-plot Single line functions for detailed visualizations The quickest and easiest way to go from analysis... ...to this. Scikit-plot i

Reiichiro Nakano 2.3k Dec 31, 2022
The Spectral Diagram (SD) is a new tool for the comparison of time series in the frequency domain

The Spectral Diagram (SD) is a new tool for the comparison of time series in the frequency domain. The SD provides a novel way to display the coherence function, power, amplitude, phase, and skill sc

Mabel 3 Oct 10, 2022
A Python toolbox for gaining geometric insights into high-dimensional data

"To deal with hyper-planes in a 14 dimensional space, visualize a 3D space and say 'fourteen' very loudly. Everyone does it." - Geoff Hinton Overview

Contextual Dynamics Laboratory 1.8k Dec 29, 2022
Data Visualization Guide for Presentations, Reports, and Dashboards

This is a highly practical and example-based guide on visually representing data in reports and dashboards.

Anton Zhiyanov 395 Dec 29, 2022
Visualize large time-series data in plotly

plotly_resampler enables visualizing large sequential data by adding resampling functionality to Plotly figures. In this Plotly-Resampler demo over 11

PreDiCT.IDLab 604 Dec 28, 2022
A concise grammar of interactive graphics, built on Vega.

Vega-Lite Vega-Lite provides a higher-level grammar for visual analysis that generates complete Vega specifications. You can find more details, docume

Vega 4k Jan 08, 2023
Plot-configurations for scientific publications, purely based on matplotlib

TUEplots Plot-configurations for scientific publications, purely based on matplotlib. Usage Please have a look at the examples in the example/ directo

Nicholas Krämer 487 Jan 08, 2023
NumPy and Pandas interface to Big Data

Blaze translates a subset of modified NumPy and Pandas-like syntax to databases and other computing systems. Blaze allows Python users a familiar inte

Blaze 3.1k Jan 01, 2023
🐞 📊 Ladybug extension to generate 2D charts

ladybug-charts Ladybug extension to generate 2D charts. Installation pip install ladybug-charts QuickStart import ladybug_charts API Documentation Loc

Ladybug Tools 3 Dec 30, 2022
Some problems of SSLC ( High School ) before outputs and after outputs

Some problems of SSLC ( High School ) before outputs and after outputs 1] A Python program and its output (output1) while running the program is given

Fayas Noushad 3 Dec 01, 2021
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 10.2k Dec 30, 2022
1900-2016 Olympic Data Analysis in Python by plotting different graphs

🔥 Olympics Data Analysis 🔥 In Data Science field, there is a big topic before creating a model for future prediction is Data Analysis. We can find o

Sayan Roy 1 Feb 06, 2022
DALLE-tools provided useful dataset utilities to improve you workflow with WebDatasets.

DALLE tools DALLE-tools is a github repository with useful tools to categorize, annotate or check the sanity of your datasets. Installation Just clone

11 Dec 25, 2022
Some method of processing point cloud

Point-Cloud Some method of processing point cloud inversion the completion pointcloud to incomplete point cloud Some model of encoding point cloud to

Tan 1 Nov 19, 2021