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
Data Analysis: Data Visualization of Airlines

Data Analysis: Data Visualization of Airlines Anderson Cruz | London-UK | Linkedin | Nowa Capital Project: Traffic Airlines Airline Reporting Carrier

Anderson Cruz 1 Feb 10, 2022
ecoglib: visualization and statistics for high density microecog signals

ecoglib: visualization and statistics for high density microecog signals This library contains high-level analysis tools for "topos" and "chronos" asp

1 Nov 17, 2021
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
Implement the Perspective open source code in preparation for data visualization

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

Abdulazeez Jimoh 1 Jan 23, 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
AB-test-analyzer - Python class to perform AB test analysis

AB-test-analyzer Python class to perform AB test analysis Overview This repo con

13 Jul 16, 2022
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 06, 2022
Plot toolbox based on Matplotlib, simple and elegant.

Elegant-Plot Plot toolbox based on Matplotlib, simple and elegant. 绘制效果 绘制过程 数据准备 每种图标类型的目录下有data.csv文件,依据样例数据填入自己的数据。

3 Jul 15, 2022
Print matplotlib colors

mplcolors Tired of searching "matplotlib colors" every week/day/hour? This simple script displays them all conveniently right in your terminal emulato

Brandon Barker 32 Dec 13, 2022
This is a Web scraping project using BeautifulSoup and Python to scrape basic information of all the Test matches played till Jan 2022.

Scraping-test-matches-data This is a Web scraping project using BeautifulSoup and Python to scrape basic information of all the Test matches played ti

Souradeep Banerjee 4 Oct 10, 2022
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
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
Bar Chart of the number of Senators from each party who are up for election in the next three General Elections

Congress-Analysis Bar Chart of the number of Senators from each party who are up for election in the next three General Elections This bar chart shows

11 Oct 26, 2021
Alternative layout visualizer for ZSA Moonlander keyboard

General info This is a keyboard layout visualizer for ZSA Moonlander keyboard (because I didn't find their Oryx or their training tool particularly us

10 Jul 19, 2022
Sentiment Analysis application created with Python and Dash, hosted at socialsentiment.net

Social Sentiment Dash Application Live-streaming sentiment analysis application created with Python and Dash, hosted at SocialSentiment.net. Dash Tuto

Harrison 456 Dec 25, 2022
A small tool to test and visualize protein embeddings and amino acid proportions.

polyprotein_stats A small tool to test and visualize protein embeddings and amino acid proportions. Currently deployed on streamlit.io. Given a set of

2 Jan 07, 2023
Parallel t-SNE implementation with Python and Torch wrappers.

Multicore t-SNE This is a multicore modification of Barnes-Hut t-SNE by L. Van der Maaten with python and Torch CFFI-based wrappers. This code also wo

Dmitry Ulyanov 1.7k Jan 09, 2023
Visualization Data Drug in thailand during 2014 to 2020

Visualization Data Drug in thailand during 2014 to 2020 Data sorce from ข้อมูลเปิดภาครัฐ สำนักงาน ป.ป.ส Inttroducing program Using tkinter module for

Narongkorn 1 Jan 05, 2022
A python wrapper for creating and viewing effects for Matt Parker's christmas tree.

Christmas Tree Visualizer A python wrapper for creating and viewing effects for Matt Parker's christmas tree. Displays py or csv effect files and allo

4 Nov 22, 2022
High-level geospatial data visualization library for Python.

geoplot: geospatial data visualization geoplot is a high-level Python geospatial plotting library. It's an extension to cartopy and matplotlib which m

Aleksey Bilogur 1k Jan 01, 2023