Englishized
This commit is contained in:
parent
9425079a2b
commit
da16480e75
1 changed files with 23 additions and 25 deletions
|
@ -2,14 +2,13 @@ import os
|
||||||
import random
|
import random
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# Ana kod Halhadus tarafından yazılmış ve DeepSeek-R1 tarafından optimize ve stilize edilmiştir.
|
# Main code written by Halhadus, optimized and stylized by DeepSeek-R1
|
||||||
|
|
||||||
def randomize(listurl):
|
def randomize(listurl): # Data fetching and cleaning
|
||||||
# Veri çekme ve temizleme
|
|
||||||
musiclist = requests.get(listurl).text.split("\n")
|
musiclist = requests.get(listurl).text.split("\n")
|
||||||
musiclist = [m.strip() for m in musiclist if m.strip() != ""]
|
musiclist = [m.strip() for m in musiclist if m.strip() != ""]
|
||||||
|
|
||||||
# HTML başlangıç template'i
|
# HTML base template
|
||||||
html = """<!DOCTYPE html>
|
html = """<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -69,21 +68,20 @@ def randomize(listurl):
|
||||||
<div style="max-width: 800px; margin: 0 auto; padding: 20px;">
|
<div style="max-width: 800px; margin: 0 auto; padding: 20px;">
|
||||||
<!-- Source Banner -->
|
<!-- Source Banner -->
|
||||||
<div class="source-banner">
|
<div class="source-banner">
|
||||||
<a href="https://git.halhadus.rocks/Halhadus/my-music-list"
|
<a href="https://git.halhadus.rocks/Halhadus/my-music-list"
|
||||||
style="color: #ffffff; text-decoration: none;">
|
style="color: #ffffff; text-decoration: none;">
|
||||||
[ 📜 Source Code & History ]
|
[ 📜 Source Code & History ]
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>Music List</h1>
|
<h1>Music List</h1>
|
||||||
|
|
||||||
<!-- Kontrol Butonları -->
|
<!-- Control Buttons -->
|
||||||
<div style="margin-bottom: 30px; display: flex; gap: 10px;">
|
<div style="margin-bottom: 30px; display: flex; gap: 10px;">
|
||||||
<button onclick="window.location.href = 'https://halhadus.rocks/index.html'"
|
<button onclick="window.location.href = 'https://halhadus.rocks/index.html'"
|
||||||
class="play-button">
|
class="play-button">
|
||||||
← Main Page
|
← Main Page
|
||||||
</button>
|
</button>
|
||||||
<button onclick="window.open(document.links[Math.floor(Math.random() * document.links.length)].href)"
|
<button onclick="window.open(document.links[Math.floor(Math.random() * document.links.length)].href)"
|
||||||
class="play-button">
|
class="play-button">
|
||||||
Random Track →
|
Random Track →
|
||||||
</button>
|
</button>
|
||||||
|
@ -92,24 +90,24 @@ def randomize(listurl):
|
||||||
random.shuffle(musiclist)
|
random.shuffle(musiclist)
|
||||||
musiccount = 0
|
musiccount = 0
|
||||||
|
|
||||||
# Müzik kartları oluşturma
|
# Music cards creation
|
||||||
for music in musiclist:
|
for music in musiclist:
|
||||||
try:
|
try:
|
||||||
parts = music.split(" --- ")
|
parts = music.split(" --- ")
|
||||||
if len(parts) != 3:
|
if len(parts) != 3:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
title, vid, platform = parts
|
title, vid, platform = parts
|
||||||
musiccount += 1
|
musiccount += 1
|
||||||
|
|
||||||
# Thumbnail URL'si
|
# Thumbnail URL
|
||||||
thumbnail_url = f"https://img.youtube.com/vi/{vid}/hqdefault.jpg"
|
thumbnail_url = f"https://img.youtube.com/vi/{vid}/hqdefault.jpg"
|
||||||
|
|
||||||
# Platforma göre URL belirleme
|
# Determine URL based on platform
|
||||||
base_url = "music.youtube.com" if platform == "YTM" else "www.youtube.com"
|
base_url = "music.youtube.com" if platform == "YTM" else "www.youtube.com"
|
||||||
yt_url = f"https://{base_url}/watch?v={vid}"
|
yt_url = f"https://{base_url}/watch?v={vid}"
|
||||||
|
|
||||||
# HTML blok
|
# HTML block
|
||||||
html += f"""
|
html += f"""
|
||||||
<div class="music-card">
|
<div class="music-card">
|
||||||
<div style="margin-bottom: 10px; display: flex; align-items: center;">
|
<div style="margin-bottom: 10px; display: flex; align-items: center;">
|
||||||
|
@ -119,16 +117,16 @@ def randomize(listurl):
|
||||||
{platform} →
|
{platform} →
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<img src="{thumbnail_url}"
|
<img src="{thumbnail_url}"
|
||||||
class="thumbnail"
|
class="thumbnail"
|
||||||
alt="{title} Cover Art"
|
alt="{title} Cover Art"
|
||||||
onerror="this.style.display='none'">
|
onerror="this.style.display='none'">
|
||||||
</div>"""
|
</div>"""
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing: {music} - {str(e)}")
|
print(f"Error processing: {music} - {str(e)}")
|
||||||
|
|
||||||
# Footer kısmı
|
# Footer section
|
||||||
html += f"""
|
html += f"""
|
||||||
<div style="margin-top: 40px; text-align: center; color: #666;">
|
<div style="margin-top: 40px; text-align: center; color: #666;">
|
||||||
<div style="margin-bottom: 15px;">
|
<div style="margin-bottom: 15px;">
|
||||||
|
@ -138,5 +136,5 @@ def randomize(listurl):
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
||||||
return html
|
return html
|
Loading…
Add table
Reference in a new issue