-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWebDatabase.py
69 lines (57 loc) · 2.16 KB
/
WebDatabase.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
### This is for fast opening of website
from colorama import Fore
def lower_string_list(my_list):
new_list = [[x.lower() for x in sub_list] for sub_list in my_list]
return new_list
def create_website_dictionary(website_list):
return {website[0].lower(): website[1] for website in website_list}
website_list = websites_list = [
["Google", "www.google.com"],
["Facebook", "www.facebook.com"],
["YouTube", "www.youtube.com"],
["Amazon", "www.amazon.com"],
["Twitter", "www.twitter.com"],
["Instagram", "www.instagram.com"],
["LinkedIn", "www.linkedin.com"],
["Reddit", "www.reddit.com"],
["Netflix", "www.netflix.com"],
["Wikipedia", "www.wikipedia.org"],
["Microsoft", "www.microsoft.com"],
["Apple", "www.apple.com"],
["GitHub", "www.github.com"],
["Stack Overflow", "www.stackoverflow.com"],
["CNN", "www.cnn.com"],
["BBC", "www.bbc.com"],
["The New York Times", "www.nytimes.com"],
["National Geographic", "www.nationalgeographic.com"],
["Etsy", "www.etsy.com"],
["Pinterest", "www.pinterest.com"],
["Tumblr", "www.tumblr.com"],
["Spotify", "www.spotify.com"],
["Adobe", "www.adobe.com"],
["Dropbox", "www.dropbox.com"],
["Quora", "www.quora.com"],
["Alibaba", "www.alibaba.com"],
["BBC Sport", "www.bbc.com/sport"],
["CNN Business", "www.cnn.com/business"],
["The Guardian", "www.theguardian.com"],
["Weather.com", "weather.com"],
["TripAdvisor", "www.tripadvisor.com"],
["Chat GPT", "www.chat.openai.com"],
["whatsapp", "web.whatsapp.com"],
# Add more websites as needed
]
website_list = lower_string_list(website_list)
websites_dict = create_website_dictionary(website_list)
def web_list_search(search_text):
c = False
try:
website_address = websites_dict.get(search_text)
if website_address:
website_address = "https://" + website_address
return website_address
else:
return "none"
except Exception:
print(Fore.RED+f"Error while searching for {search_text} in website list.")
return "none"