27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
# gpt
|
|
|
|
# Define the list of colors
|
|
colors = ["#f1672b", "#fea419", "#efd515", "#89d842", "#35c2f9", "#9b5fe0", "#ff68cf"]
|
|
|
|
# Read the input HTML file
|
|
with open("input.html", "r") as file:
|
|
lines = file.readlines()
|
|
|
|
# Open a new file to write the modified HTML content
|
|
with open("output.html", "w") as file:
|
|
# Iterate through the lines and modify them with sequential colors
|
|
for index, line in enumerate(lines):
|
|
# Extract user ID and username
|
|
user_id_start = line.find('/users/') + len('/users/')
|
|
user_id_end = line.find('">', user_id_start)
|
|
user_id = line[user_id_start:user_id_end]
|
|
username_start = line.find('@', user_id_end) + 1
|
|
username_end = line.find('</a>', username_start)
|
|
username = line[username_start:username_end]
|
|
# Construct the modified line
|
|
modified_line = f'<span class="rainbow">❤ </span><a href="https://sketchersunited.org/users/{user_id}" style="color: {colors[index % len(colors)]};">@{username}</a><br>\n'
|
|
# Write the modified line to the output file
|
|
file.write(modified_line)
|
|
|
|
print("HTML file successfully processed and saved as output.html")
|