autobuild tools

This commit is contained in:
tasi788 2020-08-13 09:49:02 +08:00
parent ae49aee501
commit b3a89fb6af
2 changed files with 46 additions and 0 deletions

35
.github/workflows/gen_nofarm.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Hide_FarmContent_From_Search
on:
push:
branches: [ master ]
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Run AutoBuild
run: |
cd AutoBuild
python hide_farm.py
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add hide_farm_from_search.txt
git commit -m "AutoBuild"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.FUTAFILTERAUTOBUILD }}

11
AutoBuild/hide_farm.py Normal file
View File

@ -0,0 +1,11 @@
domain_list = ''
with open('../nofarm_hosts.txt', 'r') as files:
for domains in files.read().split('\n'):
if domains:
domain = domains[2:-1]
domain_list += 'google.*##div.g:has(a[href*="{domain}"])\n'.format(
domain=domain
)
with open('../hide_farm_from_search.txt', 'w') as files:
files.write(domain_list)