├── .github └── workflows │ └── m3u_Generator.yml ├── LICENSE ├── README.md ├── assets ├── GET A SUBSCRIPTION, PLEASE !!.mp4 ├── Multiple Connections Detected.mp4 ├── moose.png ├── moose_na.m3u ├── moose_na0.ts ├── moose_na1.ts ├── moose_na2.ts ├── multi_conn.m3u8 ├── multi_conn0.ts ├── multi_conn1.ts ├── multi_conn2.ts ├── multi_conn3.ts ├── multi_conn4.ts ├── nosub.m3u8 ├── nosub0.ts ├── nosub1.ts ├── nosub2.ts ├── nosub3.ts ├── nosub4.ts ├── nosub5.ts └── nosub6.ts ├── autorun.bat ├── autorun.sh ├── scripts └── youtube_m3ugrabber.py ├── youtube.m3u └── youtube_channel_info.txt /.github/workflows/m3u_Generator.yml: -------------------------------------------------------------------------------- 1 | name: M3U generator 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0/3 * * *' 6 | pull_request: 7 | branches: 8 | - main 9 | workflow_dispatch: 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - name: Set up Node.js 19 | uses: actions/setup-node@v4 20 | with: 21 | node-version: '20' 22 | 23 | - name: Configure Git 24 | run: | 25 | git config --global user.email "action@github.com" 26 | git config --global user.name "GitHub Action" 27 | 28 | - name: Run main script 29 | run: | 30 | pwd 31 | chmod +x autorun.sh 32 | ./autorun.sh 33 | 34 | - name: Stage changes 35 | run: | 36 | git add -A 37 | ls -la 38 | 39 | - name: Commit and push 40 | run: | 41 | git commit -m "links are updated" || echo "No changes to commit" 42 | git push 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 benmoose39 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

YouTube_to_m3u

3 | 4 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/youtube.m3u 5 | 6 | -------------------------------------------------------------------------------- /assets/GET A SUBSCRIPTION, PLEASE !!.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/GET A SUBSCRIPTION, PLEASE !!.mp4 -------------------------------------------------------------------------------- /assets/Multiple Connections Detected.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/Multiple Connections Detected.mp4 -------------------------------------------------------------------------------- /assets/moose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/moose.png -------------------------------------------------------------------------------- /assets/moose_na.m3u: -------------------------------------------------------------------------------- 1 | #EXTM3U 2 | #EXT-X-VERSION:3 3 | #EXT-X-TARGETDURATION:14 4 | #EXT-X-MEDIA-SEQUENCE:0 5 | #EXTINF:13.533333, 6 | moose_na0.ts 7 | #EXTINF:6.766667, 8 | moose_na1.ts 9 | #EXTINF:9.766667, 10 | moose_na2.ts 11 | #EXT-X-ENDLIST 12 | -------------------------------------------------------------------------------- /assets/moose_na0.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/moose_na0.ts -------------------------------------------------------------------------------- /assets/moose_na1.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/moose_na1.ts -------------------------------------------------------------------------------- /assets/moose_na2.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/moose_na2.ts -------------------------------------------------------------------------------- /assets/multi_conn.m3u8: -------------------------------------------------------------------------------- 1 | #EXTM3U 2 | #EXT-X-VERSION:4 3 | #EXT-X-TARGETDURATION:2 4 | #EXT-X-MEDIA-SEQUENCE:0 5 | #EXTINF:2.000000, 6 | #EXT-X-BYTERANGE:134420@0 7 | multi_conn0.ts 8 | #EXTINF:2.000000, 9 | #EXT-X-BYTERANGE:136488@134420 10 | multi_conn0.ts 11 | #EXTINF:2.000000, 12 | #EXT-X-BYTERANGE:136676@270908 13 | multi_conn0.ts 14 | #EXTINF:2.000000, 15 | #EXT-X-BYTERANGE:150400@407584 16 | multi_conn0.ts 17 | #EXTINF:2.000000, 18 | #EXT-X-BYTERANGE:164312@0 19 | multi_conn1.ts 20 | #EXTINF:2.000000, 21 | #EXT-X-BYTERANGE:178224@164312 22 | multi_conn1.ts 23 | #EXTINF:2.000000, 24 | #EXT-X-BYTERANGE:184240@342536 25 | multi_conn1.ts 26 | #EXTINF:2.000000, 27 | #EXT-X-BYTERANGE:193076@0 28 | multi_conn2.ts 29 | #EXTINF:2.000000, 30 | #EXT-X-BYTERANGE:196272@193076 31 | multi_conn2.ts 32 | #EXTINF:2.000000, 33 | #EXT-X-BYTERANGE:203040@389348 34 | multi_conn2.ts 35 | #EXTINF:2.000000, 36 | #EXT-X-BYTERANGE:211124@0 37 | multi_conn3.ts 38 | #EXTINF:2.000000, 39 | #EXT-X-BYTERANGE:209432@211124 40 | multi_conn3.ts 41 | #EXTINF:2.000000, 42 | #EXT-X-BYTERANGE:216764@420556 43 | multi_conn3.ts 44 | #EXTINF:2.000000, 45 | #EXT-X-BYTERANGE:213944@0 46 | multi_conn4.ts 47 | #EXTINF:2.000000, 48 | #EXT-X-BYTERANGE:214884@213944 49 | multi_conn4.ts 50 | #EXT-X-ENDLIST 51 | -------------------------------------------------------------------------------- /assets/multi_conn0.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/multi_conn0.ts -------------------------------------------------------------------------------- /assets/multi_conn1.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/multi_conn1.ts -------------------------------------------------------------------------------- /assets/multi_conn2.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/multi_conn2.ts -------------------------------------------------------------------------------- /assets/multi_conn3.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/multi_conn3.ts -------------------------------------------------------------------------------- /assets/multi_conn4.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/multi_conn4.ts -------------------------------------------------------------------------------- /assets/nosub.m3u8: -------------------------------------------------------------------------------- 1 | #EXTM3U 2 | #EXT-X-VERSION:4 3 | #EXT-X-TARGETDURATION:4 4 | #EXT-X-MEDIA-SEQUENCE:0 5 | #EXTINF:3.600000, 6 | #EXT-X-BYTERANGE:439732@0 7 | nosub0.ts 8 | #EXTINF:1.800000, 9 | #EXT-X-BYTERANGE:284444@439732 10 | nosub0.ts 11 | #EXTINF:1.800000, 12 | #EXT-X-BYTERANGE:312456@0 13 | nosub1.ts 14 | #EXTINF:1.800000, 15 | #EXT-X-BYTERANGE:208680@312456 16 | nosub1.ts 17 | #EXTINF:1.800000, 18 | #EXT-X-BYTERANGE:367728@0 19 | nosub2.ts 20 | #EXTINF:1.800000, 21 | #EXT-X-BYTERANGE:256244@367728 22 | nosub2.ts 23 | #EXTINF:1.800000, 24 | #EXT-X-BYTERANGE:228984@0 25 | nosub3.ts 26 | #EXTINF:1.800000, 27 | #EXT-X-BYTERANGE:367352@228984 28 | nosub3.ts 29 | #EXTINF:1.800000, 30 | #EXT-X-BYTERANGE:220712@0 31 | nosub4.ts 32 | #EXTINF:3.600000, 33 | #EXT-X-BYTERANGE:605360@220712 34 | nosub4.ts 35 | #EXTINF:1.800000, 36 | #EXT-X-BYTERANGE:212252@0 37 | nosub5.ts 38 | #EXTINF:1.800000, 39 | #EXT-X-BYTERANGE:281436@212252 40 | nosub5.ts 41 | #EXTINF:1.800000, 42 | #EXT-X-BYTERANGE:318660@493688 43 | nosub5.ts 44 | #EXTINF:1.800000, 45 | #EXT-X-BYTERANGE:211312@0 46 | nosub6.ts 47 | #EXTINF:0.240000, 48 | #EXT-X-BYTERANGE:290460@211312 49 | nosub6.ts 50 | #EXT-X-ENDLIST 51 | -------------------------------------------------------------------------------- /assets/nosub0.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub0.ts -------------------------------------------------------------------------------- /assets/nosub1.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub1.ts -------------------------------------------------------------------------------- /assets/nosub2.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub2.ts -------------------------------------------------------------------------------- /assets/nosub3.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub3.ts -------------------------------------------------------------------------------- /assets/nosub4.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub4.ts -------------------------------------------------------------------------------- /assets/nosub5.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub5.ts -------------------------------------------------------------------------------- /assets/nosub6.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/c6a0534cc8c1e9ad8169dbe35800e7657fbfa049/assets/nosub6.ts -------------------------------------------------------------------------------- /autorun.bat: -------------------------------------------------------------------------------- 1 | pip install requests 2 | 3 | cd scripts/ 4 | python youtube_m3ugrabber.py > ../youtube.m3u 5 | -------------------------------------------------------------------------------- /autorun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo $(dirname $0) 4 | 5 | python3 -m pip install requests 6 | 7 | cd $(dirname $0)/scripts/ 8 | 9 | python3 youtube_m3ugrabber.py > ../youtube.m3u 10 | 11 | echo m3u grabbed 12 | -------------------------------------------------------------------------------- /scripts/youtube_m3ugrabber.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python3 2 | 3 | banner = r''' 4 | ######################################################################### 5 | # ____ _ _ __ __ # 6 | # | _ \ _ __ ___ (_) ___ ___| |_| \/ | ___ ___ ___ ___ # 7 | # | |_) | '__/ _ \| |/ _ \/ __| __| |\/| |/ _ \ / _ \/ __|/ _ \ # 8 | # | __/| | | (_) | | __/ (__| |_| | | | (_) | (_) \__ \ __/ # 9 | # |_| |_| \___// |\___|\___|\__|_| |_|\___/ \___/|___/\___| # 10 | # |__/ # 11 | # # 12 | ######################################################################### 13 | ''' 14 | 15 | import requests 16 | import os 17 | import sys 18 | 19 | windows = False 20 | if 'win' in sys.platform: 21 | windows = True 22 | 23 | def grab(url): 24 | response = requests.get(url, timeout=15).text 25 | if '.m3u8' not in response: 26 | #response = requests.get(url).text 27 | if '.m3u8' not in response: 28 | if windows: 29 | print('https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u') 30 | return 31 | #os.system(f'wget {url} -O temp.txt') 32 | os.system(f'curl "{url}" > temp.txt') 33 | response = ''.join(open('temp.txt').readlines()) 34 | if '.m3u8' not in response: 35 | print('https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u') 36 | return 37 | end = response.find('.m3u8') + 5 38 | tuner = 100 39 | while True: 40 | if 'https://' in response[end-tuner : end]: 41 | link = response[end-tuner : end] 42 | start = link.find('https://') 43 | end = link.find('.m3u8') + 5 44 | break 45 | else: 46 | tuner += 5 47 | print(f"{link[start : end]}") 48 | 49 | print('#EXTM3U x-tvg-url="https://github.com/botallen/epg/releases/download/latest/epg.xml"') 50 | print(banner) 51 | #s = requests.Session() 52 | with open('../youtube_channel_info.txt') as f: 53 | for line in f: 54 | line = line.strip() 55 | if not line or line.startswith('~~'): 56 | continue 57 | if not line.startswith('https:'): 58 | line = line.split('|') 59 | ch_name = line[0].strip() 60 | grp_title = line[1].strip().title() 61 | tvg_logo = line[2].strip() 62 | tvg_id = line[3].strip() 63 | print(f'\n#EXTINF:-1 group-title="{grp_title}" tvg-logo="{tvg_logo}" tvg-id="{tvg_id}", {ch_name}') 64 | else: 65 | grab(line) 66 | 67 | if 'temp.txt' in os.listdir(): 68 | os.system('rm temp.txt') 69 | os.system('rm watch*') 70 | -------------------------------------------------------------------------------- /youtube.m3u: -------------------------------------------------------------------------------- 1 | #EXTM3U x-tvg-url="https://github.com/botallen/epg/releases/download/latest/epg.xml" 2 | 3 | ######################################################################### 4 | # ____ _ _ __ __ # 5 | # | _ \ _ __ ___ (_) ___ ___| |_| \/ | ___ ___ ___ ___ # 6 | # | |_) | '__/ _ \| |/ _ \/ __| __| |\/| |/ _ \ / _ \/ __|/ _ \ # 7 | # | __/| | | (_) | | __/ (__| |_| | | | (_) | (_) \__ \ __/ # 8 | # |_| |_| \___// |\___|\___|\__|_| |_|\___/ \___/|___/\___| # 9 | # |__/ # 10 | # # 11 | ######################################################################### 12 | 13 | 14 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 华语歌曲一 15 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 16 | 17 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 华语歌曲二 18 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 19 | 20 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 华语歌曲三 21 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 22 | 23 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 西游记 24 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 25 | 26 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 全球音乐 27 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 28 | 29 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 小猪佩奇-英文版 30 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 31 | 32 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 4K动物-原声 33 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 34 | 35 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 4K风景 36 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 37 | 38 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 4K风景-音乐 39 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 40 | 41 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 空间站 42 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 43 | 44 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 放松/自然 45 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 46 | 47 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 연합뉴스TV 48 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 49 | 50 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", YTN뉴스 51 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 52 | 53 | #EXTINF:-1 group-title="Youtube" tvg-logo="" tvg-id="", 한국경제TV 54 | https://raw.githubusercontent.com/gyssi007/YouTube_to_m3u/main/assets/moose_na.m3u 55 | -------------------------------------------------------------------------------- /youtube_channel_info.txt: -------------------------------------------------------------------------------- 1 | 华语歌曲一 | YouTube | | 2 | https://www.youtube.com/watch?v=hSzt7cJOT80 3 | 4 | 华语歌曲二 | YouTube | | 5 | https://www.youtube.com/watch?v=zx_eIhEr7eo 6 | 7 | 华语歌曲三 | YouTube | | 8 | https://www.youtube.com/watch?v=XMtCbu6va_8 9 | 10 | 西游记 | YouTube | | 11 | https://www.youtube.com/watch?v=Wr7qwP8T0QA 12 | 13 | 全球音乐 | YouTube | | 14 | https://www.youtube.com/watch?v=36YnV9STBqc 15 | 16 | 小猪佩奇-英文版 | YouTube | | 17 | https://www.youtube.com/watch?v=2HfU8YSoqoQ 18 | 19 | 4K动物-原声 | YouTube | | 20 | https://www.youtube.com/watch?v=U5juG8dT-Z0 21 | 22 | 4K风景 | YouTube | | 23 | https://www.youtube.com/watch?v=NJUjU9ALj4A 24 | 25 | 4K风景-音乐 | YouTube | | 26 | https://www.youtube.com/watch?v=uXNU0XgGZhs 27 | 28 | 空间站 | YouTube | | 29 | https://www.youtube.com/watch?v=0FBiyFpV__g 30 | 31 | 放松/自然 | YouTube | | 32 | https://www.youtube.com/watch?v=jfKfPfyJRdk 33 | 34 | 연합뉴스TV | YouTube | | 35 | https://www.youtube.com/watch?v=6QZ_qc75ihU 36 | 37 | YTN뉴스 | YouTube | | 38 | https://www.youtube.com/watch?v=ZpCbRGFIAHo 39 | 40 | 한국경제TV | YouTube | | 41 | https://www.youtube.com/watch?v=NJUjU9ALj4A 42 | --------------------------------------------------------------------------------