Commit 1e7ef6a 1 parent 4ab42bf commit 1e7ef6a Copy full SHA for 1e7ef6a
File tree 1 file changed +0
-24
lines changed
1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change 1
1
import re
2
2
import requests
3
3
from config import Config
4
- from concurrent .futures import ThreadPoolExecutor
5
4
6
5
def getChannelItems ():
7
6
"""
@@ -84,30 +83,7 @@ def filter_source_urls(template_file):
84
83
85
84
return channels , template_channels
86
85
87
- def test_url (url ):
88
- response = requests .get (url )
89
- if response .status_code == 200 :
90
- return True
91
- else :
92
- return False
93
-
94
- def test_urls (urls ):
95
- with ThreadPoolExecutor (max_workers = 10 ) as executor :
96
- results = executor .map (test_url , urls )
97
- return list (results )
98
-
99
86
if __name__ == "__main__" :
100
87
template_file = "demo.txt"
101
88
channels , template_channels = filter_source_urls (template_file )
102
- urls_to_test = [url for channel_info in channels .values () for urls in channel_info .values () for url in urls ]
103
- results = test_urls (urls_to_test )
104
-
105
- # Remove URLs that failed the test
106
- for channel_info in channels .values ():
107
- for urls in channel_info .values ():
108
- for url in urls .copy ():
109
- if not results [0 ]:
110
- urls .remove (url )
111
- results .pop (0 )
112
-
113
89
updateChannelUrlsM3U (channels , template_channels )
You can’t perform that action at this time.
0 commit comments