Skip to content

Commit 1e7ef6a

Browse files
authored
Update main.py
1 parent 4ab42bf commit 1e7ef6a

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

main.py

-24
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22
import requests
33
from config import Config
4-
from concurrent.futures import ThreadPoolExecutor
54

65
def getChannelItems():
76
"""
@@ -84,30 +83,7 @@ def filter_source_urls(template_file):
8483

8584
return channels, template_channels
8685

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-
9986
if __name__ == "__main__":
10087
template_file = "demo.txt"
10188
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-
11389
updateChannelUrlsM3U(channels, template_channels)

0 commit comments

Comments
 (0)