Advertisement
grhkm

ett -> osu (grhkm)

May 23rd, 2022
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3. from collections import *
  4.  
  5. urls = """
  6. https://etternaonline.com/score/view/S13fbbba683de034cb3154f24c36ed7d23dad82f014605
  7. https://etternaonline.com/score/view/S9a5fed38abdca16f296faceda73e009056e9f8ab14605
  8. https://etternaonline.com/score/view/S7dccfe8f7a24d4a679c105c7628ef70f88ddab6514605
  9. https://etternaonline.com/score/view/S83cd4fcce76189edfff99385b8d6000075d32f5414605
  10. https://etternaonline.com/score/view/S666b1af9b5dc7bd303003d6dba6b048fda965a0914605
  11. """.strip().split('\n')
  12.  
  13. # OD9
  14. offset = [16, 37, 70, 100, 124, 1000]
  15. score = [320, 300, 200, 100, 50, 0]
  16.  
  17. def main(url):
  18. req = requests.get(url).text
  19. soup = BeautifulSoup(req, "html.parser")
  20. tags = soup.find_all()
  21. ele = [
  22. tag for tag in tags if tag.name == "div" and "songtitledatak" in tag.get("id", [])
  23. ][0]
  24. title, artist, pack, info = list(ele.children)[1:9:2]
  25. print(f" Title: {list(title.children)[1].text.strip()}")
  26. print(f"Artist: {list(artist.children)[1].text.strip()}")
  27. print(f" Pack: {list(pack.children)[1].text.strip()}")
  28. print(f" Info: {info.text.strip().replace(':', '/')}")
  29.  
  30. print("~" * 30)
  31.  
  32. data_tag = [tag for tag in tags if tag.name == "script"][8]
  33. data_str = ("[[" + str(data_tag).split("data: [[")[1]).split("zones")[0].strip()[:-1]
  34. data = eval(data_str)
  35. data = [u[1] for u in data]
  36.  
  37.  
  38. def get_score(s):
  39. for i in range(len(offset)):
  40. if abs(s) <= offset[i]:
  41. return score[i]
  42.  
  43.  
  44. hits = Counter(map(get_score, data))
  45. print('Judgements: ', end='')
  46. for judge in [320, 300, 200, 100, 50, 0]:
  47. print(f'{hits[judge]}x{judge}, ', end='')
  48. MA = 'inf' if hits[300] == 0 else format(hits[320] / hits[300], '.3f')
  49. PA = 'inf' if hits[200] == 0 else format(hits[300] / hits[200], '.3f')
  50. acc = (sum(min(judge, 300) * hits[judge] for judge in hits) / sum(hits.values()) / 300)
  51. print(f'\nOD9 Acc: {acc * 100:.3f}%\nMA: {MA} | PA: {PA}')
  52. print('-' * 30 + '\n')
  53.  
  54. for url in urls:
  55. main(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement