update_url
This commit is contained in:
15
.github/workflows/update_url.yml
vendored
Normal file
15
.github/workflows/update_url.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
name: update_url.py
|
||||
on:
|
||||
push:
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Prepare
|
||||
run: pip install requests
|
||||
- name: Run update_url.py
|
||||
run: python update_url.py
|
||||
17
update_url.py
Normal file
17
update_url.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from subprocess import getoutput
|
||||
|
||||
import requests
|
||||
|
||||
alias = 'config'
|
||||
url = f"https://cdn.jsdelivr.net/gh/zsokami/ACL4SSR@{getoutput('git rev-parse HEAD')}/ACL4SSR_Online_Full_Mannix.ini"
|
||||
|
||||
session = requests.Session()
|
||||
session.headers['Authorization'] = 'Bearer wMZJfKSns5lLIZ7if32owHe9w06EVAV6ZjbnCoeFs65PNN95lrwDxnKSGAMV'
|
||||
api = 'https://goo.gs/api/v1/links'
|
||||
items = session.get(api, params={'search': alias, 'by': 'alias'}).json()['data']
|
||||
for item in items:
|
||||
if item['alias'] == alias:
|
||||
print(session.put(f"{api}/{item['id']}", data={'url': url}).ok)
|
||||
break
|
||||
else:
|
||||
print(session.post(api, data={'url': url, 'alias': alias}).ok)
|
||||
Reference in New Issue
Block a user