Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Get Hexcodes From Websites/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This tools allows you to get a python list formated colors.txt file containing most of the colors(*Hexcodes*) that the website had.

To use the tool you will need to import bs4 library by doing
*pip install bs4*
54 changes: 54 additions & 0 deletions Get Hexcodes From Websites/getColoursFromWeb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# import necessary libraries
from bs4 import BeautifulSoup
import requests


# function to extract html document from given url
def getHTMLdocument(url):

# request for HTML document of given url
response = requests.get(url)

if(response.status_code == 200):
# return HTML document
return response.text
else:
# return None
raise Exception("Invalid URL or Check your internet connection")


# assign required credentials
# assign URL
url_to_scrape = input("Enter the URL to be Scraped: ")

# create document
html_document = getHTMLdocument(url_to_scrape)

# create soap object
soup = BeautifulSoup(html_document, 'html.parser')

def getHash(link):
s = ''
i = 0
n = len(link)
while(i < n):
if(link[i] == '#'):
s += link[i:i+7]
i += 1
return s

# find all the anchor tags with "href"
# attribute starting with "https://"

l = set()

for link in soup.find_all('td'):
s = getHash(str(link))
if s != '':
l.add(s.lower())
file = open('colors.txt', 'a')
file.write('[')
for i in l:
file.write("'"+i+"',")
file.write(']')
file.close()
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ Incase you have anything to be followed while executing the python script mentio
| OTP Verification | https://github.com/DhanushNehru/Python-Scripts/tree/master/OTP%20%20Verify | An OTP Verification Checker OTPVerification.py |
| ROCK-PAPER-SCISSOR | https://github.com/DhanushNehru/Python-Scripts/tree/master/ROCK-PAPER-SCISSOR | A python game Rock Paper Scissor. |
| File Encryption Decryption | https://github.com/DhanushNehru/Python-Scripts/tree/master/File%20Encryption%20Decryption | Encrypts and Decrypts files using AES Algorithms for Security purposes. |
| Get Hexcodes From Websites | https://github.com/BhagatHarsh/Python-Scripts/tree/master/Get%20Hexcodes%20From%20Websites | Generates a python list containing Hexcodes from website. |