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 Library for Self Organizing Map (SOM)

SOMPY A Python Library for Self Organizing Map (SOM) As much as possible, the structure of SOM is similar to somtoolbox in Matlab. It has the followin

Vahid Moosavi 497 Dec 29, 2022
D-Analyst : High Performance Visualization Tool

D-Analyst : High Performance Visualization Tool D-Analyst is a high performance data visualization built with python and based on OpenGL. It allows to

4 Apr 14, 2022
Streamlit dashboard examples - Twitter cashtags, StockTwits, WSB, Charts, SQL Pattern Scanner

streamlit-dashboards Streamlit dashboard examples - Twitter cashtags, StockTwits, WSB, Charts, SQL Pattern Scanner Tutorial Video https://ww

122 Dec 21, 2022
3D rendered visualization of the austrian monuments registry

Visualization of the Austrian Monuments Visualization of the monument landscape of the austrian monuments registry (Bundesdenkmalamt Denkmalverzeichni

Nikolai Janakiev 3 Oct 24, 2019
Monochromatic colorscheme for matplotlib with opinionated sensible default

Monochromatic colorscheme for matplotlib with opinionated sensible default If you need a simple monochromatic colorscheme for your matplotlib figures,

Aria Ghora Prabono 2 May 06, 2022
A python-generated website for visualizing the novel coronavirus (COVID-19) data for Greece.

COVID-19-Greece A python-generated website for visualizing the novel coronavirus (COVID-19) data for Greece. Data sources Data provided by Johns Hopki

Isabelle Viktoria Maciohsek 23 Jan 03, 2023
A package for plotting maps in R with ggplot2

Attention! Google has recently changed its API requirements, and ggmap users are now required to register with Google. From a user’s perspective, ther

David Kahle 719 Jan 04, 2023
Comparing USD and GBP Exchange Rates

Currency Data Visualization Comparing USD and GBP Exchange Rates This is a bar graph comparing GBP and USD exchange rates. I chose blue for the UK bec

5 Oct 28, 2021
Use Perspective to create the chart for the trader’s dashboard

Task Overview | Installation Instructions | Link to Module 3 Introduction Experience Technology at JP Morgan Chase Try out what real work is like in t

Abdulazeez Jimoh 1 Jan 22, 2022
A deceptively simple plotting library for Streamlit

🍅 Plost A deceptively simple plotting library for Streamlit. Because you've been writing plots wrong all this time. Getting started pip install plost

Thiago Teixeira 192 Dec 29, 2022
WebApp served by OAK PoE device to visualize various streams, metadata and AI results

DepthAI PoE WebApp | Bootstrap 4 & Vue.js SPA Dashboard Based on dashmin (https:

Luxonis 6 Apr 09, 2022
A program that analyzes data from inertia measurement units installed in aircraft and generates g-exceedance curves.

A program that analyzes data from inertia measurement units installed in aircraft and generates g-exceedance curves.

Pooya 1 Dec 02, 2021
Functions for easily making publication-quality figures with matplotlib.

Data-viz utils 📈 Functions for data visualization in matplotlib 📚 API Can be installed using pip install dvu and then imported with import dvu. You

Chandan Singh 16 Sep 15, 2022
GitHubPoster - Make everything a GitHub svg poster

GitHubPoster Make everything a GitHub svg poster 支持 Strava 开心词场 扇贝 Nintendo Switch GPX 多邻国 Issue

yihong 1.3k Jan 02, 2023
Visualize and compare datasets, target values and associations, with one line of code.

In-depth EDA (target analysis, comparison, feature analysis, correlation) in two lines of code! Sweetviz is an open-source Python library that generat

Francois Bertrand 2.3k Jan 05, 2023
Package managers visualization

Software Galaxies This repository combines visualizations of major software package managers. All visualizations are available here: http://anvaka.git

Andrei Kashcha 1.4k Dec 22, 2022
Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordcloud packages

Wikipedia WordCloud App Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordclou

Siva Prakash 5 Jan 02, 2022
Matplotlib colormaps from the yt project !

cmyt Matplotlib colormaps from the yt project ! Colormaps overview The following colormaps, as well as their respective reversed (*_r) versions are av

The yt project 5 Sep 16, 2022
Generating interfaces(CLI, Qt GUI, Dash web app) from a Python function.

oneFace is a Python library for automatically generating multiple interfaces(CLI, GUI, WebGUI) from a callable Python object. oneFace is an easy way t

NaNg 31 Oct 21, 2022
A simple agent-based model used to teach the basics of OOP in my lectures

Pydemic A simple agent-based model of a pandemic. This is used to teach basic principles of object-oriented programming to master students. It is not

Fabien Maussion 2 Jun 08, 2022