Skip to content

Commit

Permalink
2024-07-04 11:34:55 CST
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 4, 2024
0 parents commit e8e3ead
Show file tree
Hide file tree
Showing 18 changed files with 154,440 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/Update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Update

on:
watch:
types: [started]
schedule:
- cron: 0,30 * * * *

env:
TZ: Asia/Shanghai

jobs:
Update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: GetTime
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S CST')"

- name: Update
run: |
# 央视源
rm -f CCTV.m3u && wget https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/ipv6.m3u -O CCTV.m3u
sed -i -n '/央视频道/,+1p' CCTV.m3u
sed -i '1i #EXTM3U' CCTV.m3u
sed -i '/^\s*$/d' CCTV.m3u
# 卫视源
rm -f CNTV.m3u && touch CNTV.m3u
wget https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/ipv6.m3u -O CNTV1.m3u && sed -i -n '/卫视频道/,+1p' CNTV1.m3u
wget https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/ipv6.m3u -O CNTV2.m3u && sed -i -n '/NewTV系列/,+1p' CNTV2.m3u
wget https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/ipv6.m3u -O CNTV3.m3u && sed -i -n '/超清频道/,+1p' CNTV3.m3u
cat CNTV1.m3u >> CNTV.m3u
cat CNTV2.m3u >> CNTV.m3u
cat CNTV3.m3u >> CNTV.m3u
rm -f CNTV1.m3u CNTV2.m3u CNTV3.m3u
sed -i '1i #EXTM3U' CNTV.m3u
sed -i '/^\s*$/d' CNTV.m3u
# 成人源
rm -f Adult.m3u && wget http://adultiptv.net/chs.m3u -O Adult.m3u
sed -i 's/XXX/成人频道/' Adult.m3u
sed -i 's/AdultIPTV.net //g' Adult.m3u
# wget https://raw.githubusercontent.com/YanG-1989/m3u/main/Adult.m3u -O AdultVideo.txt
# sed -i -n '/日本/,+1p' AdultVideo.txt
# sed -i 's/日本/成人视频/' AdultVideo.txt
# echo '' >> Adult.m3u && cat AdultVideo.txt >> Adult.m3u
# rm -f AdultVideo.txt
# sed -i '/^\s*$/d' Adult.m3u
wget http://adultiptv.net/videos.m3u8 -O temp.m3u
sed -i '/^\s*$/d' temp.m3u
sed -i '1d' temp.m3u # 删除第一行
sed -i 's/^#EXTINF:-1,/#EXTINF:-1 tvg-logo="https:\/\/i2.100024.xyz\/2023\/09\/11\/11a5d62.webp" group-title="欧美成人",/' temp.m3u
echo '' >> Adult.m3u
cat temp.m3u >> Adult.m3u
rm -f temp.m3u
# 整合源
rm -f IPTV.m3u && touch IPTV.m3u
cat CCTV.m3u >> IPTV.m3u
cat CNTV.m3u >> IPTV.m3u
cat Adult.m3u >> IPTV.m3u
sed -i '/#EXTM3U/d' IPTV.m3u
sed -i '1i #EXTM3U' IPTV.m3u
sed -i '/^\s*$/d' IPTV.m3u
# 节目源
rm -f EPG.xml && wget https://epg.112114.xyz/pp.xml -O EPG.xml
echo "Auto Update IPTV in ${{ steps.date.outputs.date }}" > README.md
- name: Clean
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout --orphan latest_branch
git add -A
git commit -am "${{ steps.date.outputs.date }}"
git branch -D Files
git branch -m Files
- name: Push
run: git push -f origin Files
40 changes: 40 additions & 0 deletions .github/workflows/convert_m3u_to_txt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Convert M3U to TXT

on:
schedule:
- cron: '*/30 * * * *'

jobs:
convert:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install m3u8 requests
- name: Run Python Script
run: python convert_m3u_to_txt.py

- name: Upload txt file as artifact
uses: actions/upload-artifact@v3
with:
name: tv.txt
path: ./tv.txt

- name: Commit and push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add tv.txt
git commit -m "Update tv.txt [skip ci]"
git push
79 changes: 79 additions & 0 deletions .github/workflows/daily_telegram_notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Daily Telegram Channel Notification

on:
schedule:
- cron: '0 0 * * *' # 每天UTC午夜执行一次

jobs:
send_notification:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # 选择Python版本

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install requests pytz
- name: Get Proxies Text
run: |
wget https://raw.githubusercontent.com/hookzof/socks5_list/master/tg/mtproto.json -O mtproto.json
wget https://raw.githubusercontent.com/hookzof/socks5_list/master/tg/socks.json -O socks.json
wget https://raw.githubusercontent.com/ALIILAPRO/MTProtoProxy/main/mtproto.txt -O mtproto.txt
- name: Send to Telegram Channel
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }}
run: |
python -c "
import json
import requests
from datetime import datetime, timedelta
import pytz

def send_message(bot_token, chat_id, text):
url = f'https://api.telegram.org/bot{bot_token}/sendMessage'
data = {
'chat_id': chat_id,
'text': text,
'parse_mode': 'Markdown'
}
response = requests.post(url, data=data)
if not response.ok:
print(f'Failed to send message: {response.content}')
else:
print('Message sent successfully')

utc_now = datetime.now(pytz.utc)

new_proxies = []
with open('mtproto.json') as mtproto_file, open('socks.json') as socks_file:
mtproto_data = json.load(mtproto_file)
socks_data = json.load(socks_file)
for proxy_list in (mtproto_data, socks_data):
for proxy in proxy_list:
if 'addTime' in proxy:
proxy_time = datetime.utcfromtimestamp(proxy['addTime'])
if utc_now - proxy_time < timedelta(days=1):
proxy_str = f\"tg://proxy?server={proxy['host']}&port={proxy['port']}&secret={proxy['secret']}\"
new_proxies.append(proxy_str)

with open('mtproto.txt') as mtproto_text_file:
for line in mtproto_text_file:
if line.startswith('tg://proxy'):
new_proxies.append(line.strip())

BATCH_SIZE = 5
messages = ['\n'.join(new_proxies[i:i + BATCH_SIZE]) for i in range(0, len(new_proxies), BATCH_SIZE)]

for message in messages:
send_message('${{ secrets.TELEGRAM_BOT_TOKEN }}', '${{ secrets.TELEGRAM_CHANNEL_ID }}', message)
"
40 changes: 40 additions & 0 deletions .github/workflows/process_tv_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Process TV List

on:
schedule:
- cron: '*/30 * * * *'

jobs:
process:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install m3u8 requests
- name: Run TV List Processor
run: python tv_list_processor.py

- name: Upload processed txt file as artifact
uses: actions/upload-artifact@v3
with:
name: tv2.txt
path: ./tv2.txt

- name: Commit and push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add tv2.txt
git commit -m "Update tv2.txt [skip ci]"
git push
41 changes: 41 additions & 0 deletions .github/workflows/tv2_to_m3u_conversion_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Daily Telegram Notification

on:
schedule:
- cron: '0 0 * * *' # 每天午夜执行一次

jobs:
send_notification:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # 选择Python版本

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Get MTProtoProxy Text
run: |
wget https://raw.githubusercontent.com/ALIILAPRO/MTProtoProxy/main/mtproto.txt -O mtproto.txt
- name: Send to Telegram in Batches of 5 Lines
run: |
TELEGRAM_BOT_TOKEN=${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID=${{ secrets.TELEGRAM_CHAT_ID }}
split -l 5 mtproto.txt part_ # split file into chunks of 5 lines each
for part in part_*; do # Iterate over each chunk
TEXT=$(cat "$part")
ENCODED_TEXT=$(echo "$TEXT" | python -c "import urllib.parse, sys; print(urllib.parse.quote_plus(sys.stdin.read()))")
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-d "chat_id=$CHAT_ID" -d text="$ENCODED_TEXT"
sleep 1 # To prevent hitting Telegram rate limits
done
rm part_* # Clean up the split files
Loading

0 comments on commit e8e3ead

Please sign in to comment.