Skip to content

Commit

Permalink
Released on 202303011408
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 1, 2023
0 parents commit 2a439a8
Show file tree
Hide file tree
Showing 19 changed files with 334,183 additions and 0 deletions.
144 changes: 144 additions & 0 deletions .github/workflows/adblock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Build adblock rules files
on:
schedule:
- cron: 0 */6 * * *
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go 1.x
uses: actions/setup-go@v3
with:
go-version: "^1.14"

- name: Set $GOPATH and more variables
run: |
echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "TAG_NAME=$(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "MODIFIED_TIME=$(date -d "8 hour" -u "+%Y年%m月%d日 %H:%M")" >> $GITHUB_ENV
echo "EASYLIST_URL=https://easylist-downloads.adblockplus.org/easylist.txt" >> $GITHUB_ENV
echo "EASYLISTCHINA_URL=https://easylist-downloads.adblockplus.org/easylistchina.txt" >> $GITHUB_ENV
echo "EASYPRIVACY_URL=https://easylist-downloads.adblockplus.org/easyprivacy.txt" >> $GITHUB_ENV
echo "CJXLIST_URL=https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjxlist.txt" >> $GITHUB_ENV
echo "CJX_ANNOYANCE_URL=https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt" >> $GITHUB_ENV
echo "ANTI_ADBLOCK_KILLER_FILTERS_URL=https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt" >> $GITHUB_ENV
echo "ANTIADBLOCKFILTERS_URL=https://easylist-downloads.adblockplus.org/antiadblockfilters.txt" >> $GITHUB_ENV
echo "ABP_FILTERS_ANTI_CV_URL=https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt" >> $GITHUB_ENV
echo "XINGGSF_MV_URL=https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/mv.txt" >> $GITHUB_ENV
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
shell: bash

- name: Initialize Git
run: |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name github-actions[bot]
- name: Checkout the "master" branch
uses: actions/checkout@v3
with:
ref: master

- name: Get every files
id: download
run: |
mkdir -p ./download/
cd ./download
curl -sSL $EASYLIST_URL | sed -e '/^! /d' -e '1c ! EasyList' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./easylist.txt
curl -sSL $EASYLISTCHINA_URL | sed -e '/^! /d' -e '1c ! EasyList China' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./easylistchina.txt
curl -sSL $EASYPRIVACY_URL | sed -e '/^! /d' -e '1c ! EasyPrivacy' -e '/^!$/d' > ./easyprivacy.txt
curl -sSL $CJXLIST_URL | sed -e '/^! /d' -e '1c ! EasyList Lite' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./cjxlist.txt
curl -sSL $CJX_ANNOYANCE_URL | sed -e '/^! /d' -e "1c ! CJX's Annoyance List" -e '/^!$/d' -e '/The End/d' -e '/^$/d' | sed '/热门话题/,+1d' > ./cjx-annoyance.txt
sed -i '/!#include cjx-ublock.txt/c !#include https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-ublock.txt' ./cjx-annoyance.txt
curl -sSL $XINGGSF_MV_URL | sed '/禁止站内新开窗/,+2d' | sed -e '/^! /d' -e '1c ! 乘风 视频广告过滤规则' -e '/^!$/d' -e '/^$/d' > ./xinggsf-mv.txt
curl -sSL $ANTIADBLOCKFILTERS_URL | sed -e '1c ! Adblock Warning Removal List' -e '/^! Checksum/,/! Please check our guidelines/d' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./antiadblockfilters.txt
curl -sSL $ABP_FILTERS_ANTI_CV_URL | sed -e '1c ! abp-filters-anti-cv' -e '/^! Checksum/,/adblockplus.org/d' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./abp-filters-anti-cv.txt
curl -sSL $ANTI_ADBLOCK_KILLER_FILTERS_URL | sed -e '1c ! AakList (Anti-Adblock Killer)' -e '/^! Title/,/^! RegExpVisualizer/d' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./anti-adblock-killer-filters.txt
for i in $(ls *.txt); do
if [[ `cat $i |wc -l` -eq 0 ]]; then
echo "status=failed">> $GITHUB_OUTPUT
break
else
echo "status=success">> $GITHUB_OUTPUT
echo "" >> $i
fi
done
- name: Generate adblock files
if: steps.download.outputs.status == 'success'
run: |
mkdir -p ./new/
cd ./download
cat ../mod/GeneralBlock.txt ../mod/TiebaBlock.txt easylist.txt easylistchina.txt easyprivacy.txt cjx-annoyance.txt xinggsf-mv.txt > ../new/ad-pc.txt
cat ../mod/GeneralBlock.txt easylist.txt easylistchina.txt easyprivacy.txt cjx-annoyance.txt > ../new/ad-mo.txt
cat ../mod/GeneralBlock.txt ../mod/TiebaBlock.txt xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt > ../new/ad.txt
cat xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt > ../new/ad2.txt
cat xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt easyprivacy.txt > ../new/ad3.txt
cat antiadblockfilters.txt abp-filters-anti-cv.txt anti-adblock-killer-filters.txt > ../new/ad-edentw.txt
for i in $(ls ../new/*.txt); do
sed -i '/^$/d' $i
done
- name: Diff and addChecksum
id: diffResult
if: steps.download.outputs.status == 'success'
run: |
mkdir -p ./old_no_title/
chmod +x ./mod/addChecksum.pl
for i in $(ls ad*.txt); do
sed '1,/^!$/d' $i > ./old_no_title/$i
done
diffFile="$(diff -q new/ old_no_title/ |grep -o '[a-zA-Z0-9-]\+.txt' |sort -u)"
if [ -n "$diffFile" ]; then
for i in $diffFile ; do
titleName=$(echo "$i" |sed 's#.txt#-title.txt#')
cat ./mod/$titleName ./new/$i > ./$i
sed -i -e "s#201412030951#$TAG_NAME#" -e "s#201412030952#$MODIFIED_TIME#" ./$i
perl ./mod/addChecksum.pl ./$i
echo "status=success">> $GITHUB_OUTPUT
done
else
echo "status=failed">> $GITHUB_OUTPUT
fi
- name: Deliver download Dir
uses: actions/upload-artifact@v3
if: steps.download.outputs.status == 'failed'
with:
name: AllFiles
path: |
./download/
- name: Deliver new and old_no_title Di
uses: actions/upload-artifact@v3
if: steps.diffResult.outputs.status == 'failed'
with:
name: AllFiles
path: |
*
!./.git/
- name: Git push assets to github & coding
if: steps.diffResult.outputs.status == 'success'
run: |
rm -rf .git/ download/ new/ old_no_title/
git init
git checkout -b master
git add --all
git commit -m "${{ env.RELEASE_NAME }}"
git remote add origin "https://${{ github.actor }}:${{ secrets.WORKFLOW_TOKEN }}@github.com/${{ github.repository }}"
#git remote set-url --add origin "https://${{ secrets.CODING_ACCOUNT }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/${{ secrets.CODING_NAME }}/list.git"
git push -u -f origin master
- name: Purge jsdelivr cache
if: steps.diffResult.outputs.status == 'success'
run: |
result=$(curl -s https://purge.jsdelivr.net/gh/o0HalfLife0o/list@master/)
if echo $result |grep -q 'success.*true'; then
echo "jsdelivr缓存更新成功"
else
echo $result
fi
42 changes: 42 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
99 changes: 99 additions & 0 deletions .github/workflows/yuedu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build YueDu Sources files
on:
schedule:
- cron: 30 21 * * *
# push:
# branches:
# - "master"

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go 1.x
uses: actions/setup-go@v3
with:
go-version: "^1.14"

- name: Set $GOPATH and more variables
run: |
echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "TAG_NAME=$(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "SHUYUAN_INDEX_URL=http://yck.mumuceo.com/yuedu/shuyuan/index.html" >> $GITHUB_ENV
echo "SHUYUAN_JSON_URL=http://yck.mumuceo.com/yuedu/shuyuan/jsons" >> $GITHUB_ENV
echo "RSSYUAN_INDEX_URL=http://yck.mumuceo.com/yuedu/rssyuan/index.html" >> $GITHUB_ENV
echo "RSSYUAN_JSON_URL=http://yck.mumuceo.com/yuedu/rssyuan/jsons" >> $GITHUB_ENV
echo "HOMEPAGE='Origin: http://yck.mumuceo.com'" >> $GITHUB_ENV
echo "REFERER='Referer: http://yck.mumuceo.com/yuedu/index/index.html'" >> $GITHUB_ENV
echo "USERAGENT='User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0'" >> $GITHUB_ENV
echo "ACCEPTLANGUAGE='Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2'" >> $GITHUB_ENV
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
shell: bash

- name: Checkout the "master" branch
uses: actions/checkout@v3
with:
ref: master

- name: Get ShuYuan files
run: |
mkdir -p ./download/
mkdir -p ./new/
cd ./download
#检索最新有搜索无声的书源id
curl -sSL "$SHUYUAN_INDEX_URL" -H "$USERAGENT" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "$ACCEPTLANGUAGE" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "X-Requested-With: XMLHttpRequest" -H "$HOMEPAGE" -H "Connection: keep-alive" -H "$REFERER" --data "page=1&limit=5000&keys=&ver=3&sousuo=1&faxian=&audio=0&tupian=0" |grep -o '\"id\":[0-9]\+' |sed 's#\"id\":##' >yuedu-all.txt
#把书源id文件分割成每400行一个
split -l 400 yuedu-all.txt yueduid
#获取书源文件
for i in $(ls yueduid*);do
curl -s -o $i.txt "$SHUYUAN_JSON_URL?id=$(sed ':a;N;s/\n/-/g;ta' $i)" -H "$USERAGENT" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "$ACCEPTLANGUAGE" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1"
sed -i -e 's#^\[#,#' -e 's#\]$##' $i.txt
done
#合并书源文件
cat yueduid*.txt |sed -e 's#^,#\[#' -e 's#$#\]#' > ../new/yuedu.txt
rm -rf ../download
- name: Get RSSYuan files
run: |
mkdir -p ./download/
cd ./download
#检索订阅源id
curl -s "$RSSYUAN_INDEX_URL" -H "$USERAGENT" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "$ACCEPTLANGUAGE" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "X-Requested-With: XMLHttpRequest" -H "$HOMEPAGE" -H "Connection: keep-alive" -H "$REFERER" --data "page=1&limit=5000&keys=" |grep -o '\"id\":[0-9]\+' |sed 's#\"id\":##' >yuedu-all.txt
#把订阅源id文件分割成每400行一个
split -l 400 yuedu-all.txt yueduid
#获取订阅源文件
for i in $(ls yueduid*);do
curl -s -o $i.txt "$RSSYUAN_JSON_URL?id=$(sed ':a;N;s/\n/-/g;ta' $i)" -H "$USERAGENT" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "$ACCEPTLANGUAGE" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1"
sed -i -e 's#^\[#,#' -e 's#\]$##' $i.txt
done
#合并订阅源文件
cat yueduid*.txt |sed -e 's#^,#\[#' -e 's#$#\]#' > ../new/yuedu-rss.txt
rm -rf ../download
- name: Check and diff
id: diffResult
run: |
cd ./new
for i in $(ls *.txt); do
if [ -s $i ]; then
fileSum=$(sha256sum $i |sed 's# .*##')
if ! echo "$fileSum ../$i"|sha256sum -c --status; then
cp -f $i ../$i
echo "::set-output name=status::success"
fi
fi
done
- name: Git push assets to "master" branch
if: steps.diffResult.outputs.status == 'success'
run: |
rm -rf download new
sed -i '/url =/d' ./.git/config
git config --local user.name "actions"
git config --local user.email "[email protected]"
git add --all
git commit -m "${{ env.RELEASE_NAME }}"
git remote set-url --add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -u origin master
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## ABP/ublock订阅规则
1. ad-pc.txt:[推荐桌面端]合并自乘风视频广告过滤规则、Easylist、EasylistChina、EasyPrivacy、CJX'sAnnoyance,以及补充的一些规则;
1. ad-mo.txt:合并自Easylist、EasylistChina、EasyPrivacy、CJX'sAnnoyance;
3. ad.txt:[推荐移动端]合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance,以及补充的一些规则;
4. ad2.txt:合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance;
5. ad3.txt:合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance、EasyPrivacy;
6. ad-edentw.txt:合并自Adblock Warning Removal List、ABP filters、anti-adblock-killer-filters。
Loading

0 comments on commit 2a439a8

Please sign in to comment.