Skip to content

Instantly share code, notes, and snippets.

@dsjt
Last active March 17, 2017 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsjt/794ca1f7c42eef6a75212db69571b243 to your computer and use it in GitHub Desktop.
Save dsjt/794ca1f7c42eef6a75212db69571b243 to your computer and use it in GitHub Desktop.
import numpy as np
import itertools
from urllib.request import urlopen
from bs4 import BeautifulSoup
class Index():
type = 0
title = 1
difficulty = 2
level = 3
time = 4
bpm = 5
totalnotes = 6
density = 7
url = "https://imascg-slstage-wiki.gamerch.com/%E6%A5%BD%E6%9B%B2%E8%A9%B3%E7%B4%B0%E4%B8%80%E8%A6%A7"
html = urlopen(url)
bsObj = BeautifulSoup(html, "html.parser")
table = bsObj.findAll("table", {"id": "ui_wikidb_table_933676"})[0]
tbody = table.findAll("tbody")[0]
rows = tbody.findAll("tr")
data_table = []
for row in rows:
data_row = []
for cell in row.findAll('td'):
data_row.append(cell.get_text())
data_table.append(data_row)
Cu_X = np.array([x for x in data_table if x[Index.difficulty] == "MASTER" and
(x[Index.type] == "全タイプ" or x[Index.type] == "キュート")])
Co_X = np.array([x for x in data_table if x[Index.difficulty] == "MASTER" and
(x[Index.type] == "全タイプ" or x[Index.type] == "クール")])
Pa_X = np.array([x for x in data_table if x[Index.difficulty] == "MASTER" and
(x[Index.type] == "全タイプ" or x[Index.type] == "パッション")])
total = sum([len([x for x in itertools.combinations(Pa_X, 3)]),
len([x for x in itertools.combinations(Co_X, 3)]),
len([x for x in itertools.combinations(Cu_X, 3)])])
event = 0
for tunes in itertools.combinations(Pa_X, 3):
s = sum([int(tunes[0][Index.totalnotes]),
int(tunes[1][Index.totalnotes]),
int(tunes[2][Index.totalnotes])])
if s == 2000:
event+=1
for tunes in itertools.combinations(Pa_X, 3):
tunes = np.array(tunes)
if np.sum(np.array(tunes[:, Index.totalnotes], dtype=int)) == 2000:
# print(tunes)
# print(np.sum(np.array(tunes[:, Index.totalnotes], dtype=int)))
print("{0:<20s} {1:<20s} {2:<20s}".format(*list(tunes[:, 1])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment