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
Insert SVGs into matplotlib

Insert SVGs into matplotlib

Andrew White 35 Dec 29, 2022
Python module for drawing and rendering beautiful atoms and molecules using Blender.

Batoms is a Python package for editing and rendering atoms and molecules objects using blender. A Python interface that allows for automating workflows.

Xing Wang 1 Jul 06, 2022
Example Code Notebooks for Data Visualization in Python

This repository contains sample code scripts for creating awesome data visualizations from scratch using different python libraries (such as matplotli

Javed Ali 27 Jan 04, 2023
Data aggregated from the reports found at the MCPS COVID Dashboard into a set of visualizations.

Montgomery County Public Schools COVID-19 Visualizer Contents About this project Data Support this project About this project Data All data we use can

James 3 Jan 19, 2022
Here are my graphs for hw_02

Let's Have A Look At Some Graphs! Graph 1: State Mentions in Congressperson's Tweets on 10/01/2017 The graph below uses this data set to demonstrate h

7 Sep 02, 2022
Bcc2telegraf: An integration that sends ebpf-based bcc histogram metrics to telegraf daemon

bcc2telegraf bcc2telegraf is an integration that sends ebpf-based bcc histogram

Peter Bobrov 2 Feb 17, 2022
Simple spectra visualization tool for astronomers

SpecViewer A simple visualization tool for astronomers. Dependencies Python = 3.7.4 PyQt5 = 5.15.4 pyqtgraph == 0.10.0 numpy = 1.19.4 How to use py

5 Oct 07, 2021
A Scheil-Gulliver simulation tool using pycalphad.

scheil A Scheil-Gulliver simulation tool using pycalphad. import matplotlib.pyplot as plt from pycalphad import Database, variables as v from scheil i

pycalphad 6 Dec 10, 2021
Main repository for Vispy

VisPy: interactive scientific visualization in Python Main website: http://vispy.org VisPy is a high-performance interactive 2D/3D data visualization

vispy 3k Jan 03, 2023
Gaphas is the diagramming widget library for Python.

Gaphas Gaphas is the diagramming widget library for Python. Gaphas is a library that provides the user interface component (widget) for drawing diagra

Gaphor 144 Dec 14, 2022
Dipto Chakrabarty 7 Sep 06, 2022
Smoking Simulation is an app to simulate the spreading of smokers and non-smokers, their interactions and population during certain amount of time.

Smoking Simulation is an app to simulate the spreading of smokers and non-smokers, their interactions and population during certain

Bohdan Ruban 5 Nov 08, 2022
Browse Dash docsets inside emacs

Helm Dash What's it This package uses Dash docsets inside emacs to browse documentation. Here's an article explaining the basic usage of it. It doesn'

504 Dec 15, 2022
Calendar heatmaps from Pandas time series data

Note: See MarvinT/calmap for the maintained version of the project. That is also the version that gets published to PyPI and it has received several f

Martijn Vermaat 195 Dec 22, 2022
Schema validation just got Pythonic

Schema validation just got Pythonic schema is a library for validating Python data structures, such as those obtained from config-files, forms, extern

Vladimir Keleshev 2.7k Jan 06, 2023
Dimensionality reduction in very large datasets using Siamese Networks

ivis Implementation of the ivis algorithm as described in the paper Structure-preserving visualisation of high dimensional single-cell datasets. Ivis

beringresearch 284 Jan 01, 2023
FURY - A software library for scientific visualization in Python

Free Unified Rendering in Python A software library for scientific visualization in Python. General Information • Key Features • Installation • How to

169 Dec 21, 2022
Visualization Library

CamViz Overview // Installation // Demos // License Overview CamViz is a visualization library developed by the TRI-ML team with the goal of providing

Toyota Research Institute - Machine Learning 67 Nov 24, 2022
A set of useful perceptually uniform colormaps for plotting scientific data

Colorcet: Collection of perceptually uniform colormaps Build Status Coverage Latest dev release Latest release Docs What is it? Colorcet is a collecti

HoloViz 590 Dec 31, 2022
a robust room presence solution for home automation with nearly no false negatives

Argos Room Presence This project builds a room presence solution on top of Argos. Using just a cheap raspberry pi zero w (plus an attached pi camera,

Angad Singh 46 Sep 18, 2022