mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-16 05:45:24 +00:00
telegraph update
This commit is contained in:
parent
0787f1390d
commit
f63d784667
1
.github/workflows/python.yml
vendored
1
.github/workflows/python.yml
vendored
@ -10,6 +10,7 @@ on:
|
|||||||
- 'list.json'
|
- 'list.json'
|
||||||
- 'telegram_update.py'
|
- 'telegram_update.py'
|
||||||
- 'update_list.py'
|
- 'update_list.py'
|
||||||
|
- 'telegraph_update.py'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
36
.github/workflows/telegraph.yml
vendored
Normal file
36
.github/workflows/telegraph.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Plugins Data To Telegraph
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: ~
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v2
|
||||||
|
paths:
|
||||||
|
- 'list.json'
|
||||||
|
- 'telegraph_update.py'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# 此步骤使用 GitHub 的 https://github.com/actions/checkout
|
||||||
|
- name: checkout actions
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# 设置python环境
|
||||||
|
# 此步骤使用 GitHub 的 https://github.com/actions/setup-python
|
||||||
|
- name: Set up Python 3.9
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install telegraph
|
||||||
|
|
||||||
|
# 更新数据
|
||||||
|
- name: Update Telegraph
|
||||||
|
run: |
|
||||||
|
python telegraph_update.py ${{ secrets.TELEGRAPH_TOKEN }}
|
28
telegraph_update.py
Normal file
28
telegraph_update.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from telegraph import Telegraph
|
||||||
|
|
||||||
|
token = str(sys.argv[1])
|
||||||
|
path = "PagerMaid-Plugins-11-27"
|
||||||
|
title = "PagerMaid Pyro 插件列表"
|
||||||
|
name = "PagerMaid-Modify Update"
|
||||||
|
url = "https://t.me/PagerMaid_Modify"
|
||||||
|
temp = """<h3 id="{0}">{0}</h3><p>{1}</p><blockquote>,apt install {0}</blockquote>"""
|
||||||
|
telegraph = Telegraph(token)
|
||||||
|
|
||||||
|
def gen():
|
||||||
|
with open("list.json", "r", encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
k = []
|
||||||
|
data["list"].sort(key=lambda i:i["name"])
|
||||||
|
for i in data["list"]:
|
||||||
|
des = i["des-short"]
|
||||||
|
if i["des"].startswith("这个人很懒") or i["des"] == i["des-short"]:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
des += i["des"]
|
||||||
|
k.append(temp.format(i["name"], des))
|
||||||
|
return "<hr>".join(k)
|
||||||
|
|
||||||
|
telegraph.edit_page(path=path, title=title, html_content=gen(), author_name=name, author_url=url)
|
Loading…
Reference in New Issue
Block a user