-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_providers.py
executable file
·93 lines (74 loc) · 4.58 KB
/
get_providers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python3
# Script to get the current list of providers
# Copyright (C) 2023-2025 Zalexanninev15
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import re
import os
import requests
gpt_list = [
'https://raw.githubusercontent.com/xtekky/gpt4free/main/README.md',
'https://raw.githubusercontent.com/LiLittleCat/awesome-free-chatgpt/main/urls.json',
'https://raw.githubusercontent.com/xx025/carrot/main/README.md',
'https://raw.githubusercontent.com/zukixa/cool-ai-stuff/main/README.md'
]
first = True
unique_urls = []
for url in gpt_list:
file_name = str(url.split('/')[-1])
try:
response = requests.get(url)
if response.status_code == 200:
with open(file_name, 'w', encoding='utf-8') as file:
file.write(response.text)
else:
print(
f'Ошибка {response.status_code}: Не удалось скачать файл. URL: {url}')
break
links = []
with open(file_name, 'r', encoding='utf-8') as f:
urls = f.readlines()
for s in urls:
if '![Active]' in s:
links.append(s.split('|')[1].split('(')[1][:-2])
if len(links) == 0:
links = re.findall('"(https?://.*?)"', ' '.join(urls))
for url1 in links:
url1 = url1.strip('"')
if url1 not in unique_urls:
if first:
unique_urls.append(url1.replace(")", ''))
first = False
else:
unique_urls.append(url1.replace(")", ''))
except Exception as e:
print(f'Error processing URL: {str(e)}')
os.remove(file_name)
result = list(set(x for x in unique_urls if not any(substring in x for substring in
['huggingface.co/chat', 'star-history', 'docs', 'api', 'bing', 'openai', '.ico', '.webp',
'getgpt', 'geekgpt', 'deepai', 'chatgpt.ch', 'chatgpt-free.ai', 'favicon',
'chatgpt.org', 'cgs.skybyte.me', 'www.chatbase.co', 'www.aitianhu.com',
'chatgpt.ai', 'powerchat.', 'p.aifree.site', 'gptgo.ai', 'ai.heptax.com', 'carrot',
'hteyun.com', 'chat.pinkfong.cn', 'c.newstop.uk', 'ai.zenglingkun.cn', '.png', '.jpg',
'nav4ai.net', 'coffeecat', 'chat.51buygpt.com', 'ai.mcbbs.gq', 'gptdidi.com', 'github', 'donate',
'chat.leadscloud.xyz', 'g01.plitun.com', 'www.chatbotui.com', 'freegpt.dingtoucake.xyz'
'academic.aiearth.dev', 'chat2.xeasy.me', 'www.chatfree.cc', 'wiki',
'www.devgpt.com', 'a.aiask.me', 'mirrorchat.extkj.cn', 'chatyou.lovebaby.today', '.svg',
'chat1.manongzyg.one', 'chat.iwoso.co', 'freegpts1.aifree.site', 'suspended-website.com',
'nb.aitom.cc', '94gpt.com', 'www.chatgptunli.com', 'chat.newstop.asia', 'ai.azstudio.top',
'xjai.cc', 'chatgpt.kiask.xyz', 'aichat.gogpt.site', 'chatgpt.bybyte.cn', 'vvanglro.eu.org',
'gpt.xeasy.me', 'bettergpt.chat', 'chat.aisoftworks.com', 'hashnode.com', 'www.typingmind.com',
'www.magicaibot.com', 'chat-shared2.zhile.io', 'home.cutim.top', 'ailink.icu', 'bard.google.com',
'discord', 'x.com', 't.me', 'file', 'static', 'slack', 'opencopilot',
'phind', 'deepinfra', 'apps.apple.com', 'play.google.com'])))
with open('providers.txt', 'w') as file:
file.write('\n'.join(result))
print('Processing is complete.')