Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- from collections import *
- urls = """
- https://etternaonline.com/score/view/S13fbbba683de034cb3154f24c36ed7d23dad82f014605
- https://etternaonline.com/score/view/S9a5fed38abdca16f296faceda73e009056e9f8ab14605
- https://etternaonline.com/score/view/S7dccfe8f7a24d4a679c105c7628ef70f88ddab6514605
- https://etternaonline.com/score/view/S83cd4fcce76189edfff99385b8d6000075d32f5414605
- https://etternaonline.com/score/view/S666b1af9b5dc7bd303003d6dba6b048fda965a0914605
- """.strip().split('\n')
- # OD9
- offset = [16, 37, 70, 100, 124, 1000]
- score = [320, 300, 200, 100, 50, 0]
- def main(url):
- req = requests.get(url).text
- soup = BeautifulSoup(req, "html.parser")
- tags = soup.find_all()
- ele = [
- tag for tag in tags if tag.name == "div" and "songtitledatak" in tag.get("id", [])
- ][0]
- title, artist, pack, info = list(ele.children)[1:9:2]
- print(f" Title: {list(title.children)[1].text.strip()}")
- print(f"Artist: {list(artist.children)[1].text.strip()}")
- print(f" Pack: {list(pack.children)[1].text.strip()}")
- print(f" Info: {info.text.strip().replace(':', '/')}")
- print("~" * 30)
- data_tag = [tag for tag in tags if tag.name == "script"][8]
- data_str = ("[[" + str(data_tag).split("data: [[")[1]).split("zones")[0].strip()[:-1]
- data = eval(data_str)
- data = [u[1] for u in data]
- def get_score(s):
- for i in range(len(offset)):
- if abs(s) <= offset[i]:
- return score[i]
- hits = Counter(map(get_score, data))
- print('Judgements: ', end='')
- for judge in [320, 300, 200, 100, 50, 0]:
- print(f'{hits[judge]}x{judge}, ', end='')
- MA = 'inf' if hits[300] == 0 else format(hits[320] / hits[300], '.3f')
- PA = 'inf' if hits[200] == 0 else format(hits[300] / hits[200], '.3f')
- acc = (sum(min(judge, 300) * hits[judge] for judge in hits) / sum(hits.values()) / 300)
- print(f'\nOD9 Acc: {acc * 100:.3f}%\nMA: {MA} | PA: {PA}')
- print('-' * 30 + '\n')
- for url in urls:
- main(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement