diff options
Diffstat (limited to 'data')
| -rw-r--r-- | data/banlist-cn.json | 75 | ||||
| -rw-r--r-- | data/banlist-md.json | 8 | ||||
| -rw-r--r-- | data/banlist-tcg.json | 201 | ||||
| -rw-r--r-- | data/banlist.json | 191 | ||||
| -rw-r--r-- | data/cn-genbanlist.py | 29 | ||||
| -rw-r--r-- | data/fetch-ocg-banlist.py | 35 | ||||
| -rw-r--r-- | data/fetch-tcg-banlist.py | 35 | ||||
| -rw-r--r-- | data/update.sh | 9 |
8 files changed, 114 insertions, 469 deletions
diff --git a/data/banlist-cn.json b/data/banlist-cn.json index 1c63a8b..00d14c3 100644 --- a/data/banlist-cn.json +++ b/data/banlist-cn.json @@ -1,74 +1 @@ -{ - "regulation": { - "4426": 0, - "4678": 1, - "4821": 1, - "4842": 1, - "4844": 0, - "5236": 1, - "5328": 1, - "5537": 1, - "5605": 0, - "5622": 1, - "5740": 1, - "6161": 2, - "6901": 1, - "7652": 1, - "7673": 2, - "7747": 2, - "9153": 0, - "9271": 2, - "9455": 2, - "10354": 0, - "12047": 2, - "12070": 1, - "12074": 1, - "12080": 0, - "12108": 0, - "12465": 2, - "12800": 2, - "12801": 2, - "12960": 0, - "12978": 1, - "13447": 1, - "13507": 1, - "13508": 1, - "13597": 0, - "13619": 2, - "13622": 1, - "13674": 1, - "14128": 0, - "14130": 0, - "14304": 2, - "14314": 0, - "14627": 1, - "15756": 1, - "16751": 0, - "17381": 1, - "17414": 2, - "17415": 2, - "17416": 1, - "17417": 1, - "17444": 0, - "17451": 0, - "17462": 1, - "17762": 1, - "17764": 1, - "17768": 1, - "17769": 1, - "17992": 2, - "18204": 1, - "18524": 1, - "18845": 1, - "19027": 1, - "19148": 1, - "19149": 1, - "19188": 1, - "19196": 1, - "19467": 1, - "19859": 1, - "19900": 1, - "20282": 2, - "20575": 2 - } -} +{"regulation": {"11195": 0, "16751": 0, "4426": 0, "17444": 0, "12080": 0, "10354": 0, "12108": 0, "12960": 0, "17451": 0, "13597": 0, "14130": 0, "14128": 0, "5605": 0, "14314": 0, "4844": 0, "9153": 0, "7652": 0, "20575": 1, "14740": 1, "19148": 1, "12070": 1, "20572": 1, "17416": 1, "17417": 1, "20584": 1, "17769": 1, "17768": 1, "19467": 1, "19149": 1, "19859": 1, "17764": 1, "17762": 1, "12074": 1, "13507": 1, "13508": 1, "19188": 1, "7570": 1, "19900": 1, "12978": 1, "19027": 1, "6901": 1, "18845": 1, "15756": 1, "12801": 1, "18204": 1, "17381": 1, "14627": 1, "13674": 1, "4678": 1, "20282": 1, "19196": 1, "4821": 1, "4842": 1, "5537": 1, "17462": 1, "5236": 1, "5328": 1, "13622": 1, "5740": 1, "13447": 1, "5622": 1, "7934": 1, "12047": 2, "17992": 2, "17414": 2, "17415": 2, "20196": 2, "9455": 2, "7673": 2, "6161": 2, "9271": 2, "14304": 2, "7747": 2, "13619": 2, "18524": 2, "12465": 2, "20240": 2, "12800": 2}}
\ No newline at end of file diff --git a/data/banlist-md.json b/data/banlist-md.json index 67a31e1..3020320 100644 --- a/data/banlist-md.json +++ b/data/banlist-md.json @@ -1,5 +1,7 @@ { + "date": "2025-04", "regulation": { + "12108": 0, "4023": 1, "4024": 1, "4025": 1, @@ -101,13 +103,12 @@ "11651": 0, "11840": 1, "11932": 0, - "11960": 0, "12070": 1, "12074": 1, "12080": 0, "12258": 0, "12412": 0, - "12433": 0, + "12433": 1, "12441": 1, "12465": 1, "12642": 0, @@ -179,7 +180,6 @@ "18153": 1, "18204": 1, "18442": 1, - "18481": 2, "19027": 2, "19149": 1, "19196": 1, @@ -187,7 +187,7 @@ "19467": 1, "19859": 1, "19900": 1, - "19901": 2, + "19901": 1, "19902": 2, "20037": 2, "20196": 2 diff --git a/data/banlist-tcg.json b/data/banlist-tcg.json index 0f741e6..00a38fa 100644 --- a/data/banlist-tcg.json +++ b/data/banlist-tcg.json @@ -1,200 +1 @@ -{ - "regulation": { - "4023": 1, - "4024": 1, - "4025": 1, - "4026": 1, - "4027": 1, - "4426": 0, - "4597": 1, - "4678": 1, - "4812": 0, - "4821": 1, - "4842": 1, - "4844": 0, - "4851": 0, - "4860": 1, - "4885": 0, - "4891": 0, - "4898": 1, - "4900": 0, - "4901": 0, - "4907": 0, - "4910": 0, - "4911": 0, - "4913": 2, - "4960": 0, - "4966": 0, - "5008": 1, - "5123": 0, - "5127": 0, - "5236": 1, - "5247": 0, - "5328": 1, - "5371": 0, - "5389": 0, - "5399": 0, - "5406": 0, - "5433": 0, - "5446": 0, - "5530": 1, - "5537": 1, - "5539": 0, - "5576": 1, - "5605": 0, - "5622": 1, - "5657": 0, - "5671": 0, - "5724": 0, - "5740": 1, - "5788": 1, - "5868": 0, - "5906": 0, - "5916": 0, - "5945": 0, - "5980": 1, - "6078": 0, - "6161": 1, - "6444": 1, - "6654": 0, - "6885": 0, - "6901": 1, - "6904": 1, - "7384": 1, - "7386": 0, - "7561": 1, - "7601": 1, - "7652": 0, - "7714": 0, - "7934": 1, - "8085": 0, - "8159": 0, - "8197": 1, - "8318": 0, - "8440": 0, - "8472": 0, - "8515": 0, - "8602": 1, - "8733": 0, - "8809": 0, - "8823": 1, - "8824": 1, - "9095": 0, - "9153": 0, - "9350": 1, - "9455": 0, - "9554": 1, - "9778": 1, - "9821": 0, - "9822": 1, - "9860": 0, - "9874": 0, - "9918": 0, - "9957": 0, - "10001": 1, - "10216": 1, - "10458": 1, - "10463": 1, - "10480": 0, - "10695": 0, - "11015": 1, - "11159": 0, - "11195": 0, - "11207": 0, - "11296": 0, - "11408": 1, - "11518": 0, - "11651": 0, - "11840": 0, - "11851": 1, - "11932": 0, - "12070": 1, - "12074": 1, - "12080": 0, - "12108": 0, - "12111": 2, - "12412": 0, - "12433": 0, - "12441": 0, - "12466": 1, - "12749": 1, - "12763": 1, - "12786": 0, - "12788": 0, - "12794": 1, - "12801": 1, - "12825": 0, - "12906": 1, - "12938": 0, - "12960": 0, - "12967": 1, - "12978": 1, - "13077": 0, - "13166": 0, - "13346": 0, - "13349": 2, - "13447": 1, - "13492": 0, - "13500": 0, - "13507": 0, - "13508": 0, - "13554": 0, - "13597": 0, - "13598": 0, - "13616": 1, - "13619": 1, - "13622": 0, - "13674": 1, - "13814": 1, - "13836": 0, - "13981": 2, - "14070": 2, - "14114": 0, - "14128": 0, - "14130": 0, - "14314": 0, - "14337": 0, - "14496": 0, - "14721": 1, - "14876": 2, - "14932": 0, - "14935": 0, - "14940": 0, - "14944": 0, - "14994": 1, - "15035": 0, - "15277": 0, - "15478": 1, - "15528": 0, - "15756": 1, - "15861": 1, - "15866": 1, - "16386": 0, - "17066": 1, - "17381": 2, - "17414": 1, - "17415": 1, - "17416": 1, - "17430": 0, - "17444": 0, - "17451": 0, - "17472": 0, - "17603": 1, - "17604": 1, - "17605": 0, - "17606": 0, - "17762": 1, - "18013": 2, - "18191": 0, - "18524": 2, - "18806": 1, - "19149": 1, - "19199": 0, - "19467": 1, - "19859": 1, - "19900": 1, - "19901": 1, - "20037": 1, - "20214": 0 - } -} +{"regulation": {"10354": 0, "17606": 0, "14496": 0, "11195": 0, "10332": 0, "16386": 0, "6885": 0, "12108": 0, "12412": 0, "12433": 0, "14114": 0, "15277": 0, "13508": 0, "13492": 0, "4426": 0, "6654": 0, "8472": 0, "9957": 0, "11207": 0, "12441": 0, "5371": 0, "20214": 0, "8318": 0, "10695": 0, "9095": 0, "7386": 0, "14130": 0, "14128": 0, "13507": 0, "12080": 0, "13500": 0, "5247": 0, "18191": 0, "17605": 0, "13598": 0, "13602": 0, "13597": 0, "9821": 0, "8440": 0, "18664": 0, "15035": 0, "13346": 0, "9874": 0, "5657": 0, "9455": 0, "14940": 0, "7714": 0, "9860": 0, "10480": 0, "11296": 0, "13166": 0, "11651": 0, "11932": 0, "11518": 0, "8159": 0, "15528": 0, "14944": 0, "8809": 0, "14935": 0, "17451": 0, "12825": 0, "13554": 0, "14337": 0, "13077": 0, "17444": 0, "8085": 0, "8733": 0, "13836": 0, "12960": 0, "14932": 0, "5868": 0, "9918": 0, "12786": 0, "12788": 0, "5724": 0, "5123": 0, "5127": 0, "4900": 0, "4901": 0, "5906": 0, "4910": 0, "4812": 0, "4891": 0, "5605": 0, "4885": 0, "5671": 0, "5539": 0, "5433": 0, "14314": 0, "19199": 0, "4911": 0, "4844": 0, "4966": 0, "5389": 0, "11159": 0, "4907": 0, "8515": 0, "17472": 0, "4960": 0, "5406": 0, "13622": 0, "6078": 0, "5399": 0, "5916": 0, "5945": 0, "7652": 0, "5446": 0, "4851": 0, "9153": 0, "14994": 1, "12906": 1, "17764": 1, "17762": 1, "9822": 1, "7561": 1, "14740": 1, "4027": 1, "10001": 1, "17603": 1, "4026": 1, "4024": 1, "12938": 1, "17430": 1, "12763": 1, "17604": 1, "10216": 1, "11015": 1, "20037": 1, "7384": 1, "12070": 1, "12074": 1, "4025": 1, "4023": 1, "20578": 1, "14721": 1, "7601": 1, "15861": 1, "15866": 1, "9554": 1, "17416": 1, "17414": 1, "17415": 1, "19859": 1, "12749": 1, "19027": 1, "17066": 1, "11840": 1, "13619": 1, "4821": 1, "5576": 1, "6904": 1, "4860": 1, "15478": 1, "11851": 1, "14627": 1, "9350": 1, "12967": 1, "5788": 1, "5236": 1, "8602": 1, "6161": 1, "4678": 1, "8823": 1, "6901": 1, "8824": 1, "12466": 1, "5980": 1, "4842": 1, "9778": 1, "8197": 1, "15756": 1, "5530": 1, "5328": 1, "19901": 1, "19900": 1, "13616": 1, "12978": 1, "13674": 1, "13814": 1, "4898": 1, "5537": 1, "12801": 1, "15296": 1, "12794": 1, "5008": 1, "7934": 1, "6444": 1, "11408": 1, "5622": 1, "5740": 1, "13447": 1, "10463": 2, "20575": 2, "20574": 2, "20584": 2, "20582": 2, "4597": 2, "19149": 2, "19467": 2, "20572": 2, "18806": 2, "10458": 2, "14876": 2, "20588": 2, "18013": 2, "18524": 2, "17381": 2}}
\ No newline at end of file diff --git a/data/banlist.json b/data/banlist.json index c640694..2e72756 100644 --- a/data/banlist.json +++ b/data/banlist.json @@ -1,190 +1 @@ -{ - "regulation": { - "4023": 1, - "4024": 1, - "4025": 1, - "4026": 1, - "4027": 1, - "4095": 0, - "4426": 0, - "4518": 0, - "4597": 2, - "4678": 1, - "4812": 0, - "4821": 1, - "4842": 1, - "4844": 0, - "4851": 0, - "4885": 0, - "4891": 1, - "4898": 2, - "4900": 0, - "4901": 0, - "4907": 0, - "4910": 0, - "4911": 0, - "4913": 1, - "4960": 0, - "4966": 0, - "5123": 0, - "5127": 0, - "5195": 0, - "5236": 1, - "5328": 1, - "5371": 0, - "5389": 0, - "5399": 0, - "5406": 0, - "5433": 0, - "5446": 0, - "5477": 0, - "5537": 1, - "5539": 0, - "5605": 0, - "5622": 1, - "5657": 0, - "5671": 0, - "5724": 0, - "5740": 1, - "5846": 1, - "5868": 0, - "5906": 0, - "5945": 0, - "6078": 0, - "6161": 1, - "6444": 0, - "6458": 0, - "6654": 0, - "6708": 0, - "6885": 0, - "6901": 1, - "7386": 0, - "7435": 0, - "7445": 2, - "7570": 1, - "7601": 0, - "7652": 1, - "7673": 1, - "7714": 0, - "7747": 2, - "7934": 1, - "8085": 0, - "8159": 0, - "8197": 1, - "8318": 0, - "8440": 0, - "8472": 0, - "8602": 1, - "8733": 0, - "9153": 0, - "9256": 1, - "9271": 1, - "9455": 2, - "9554": 1, - "9742": 0, - "9778": 1, - "9821": 0, - "9860": 0, - "9957": 0, - "10216": 1, - "10354": 0, - "11159": 0, - "11195": 1, - "11207": 0, - "11296": 0, - "11344": 0, - "11518": 0, - "11529": 1, - "11651": 0, - "11840": 1, - "11932": 0, - "12047": 2, - "12070": 1, - "12074": 1, - "12080": 0, - "12108": 0, - "12111": 2, - "12412": 0, - "12433": 1, - "12465": 2, - "12642": 0, - "12749": 1, - "12786": 0, - "12788": 1, - "12794": 2, - "12800": 2, - "12801": 2, - "12906": 1, - "12907": 2, - "12938": 2, - "12960": 0, - "12978": 1, - "13107": 1, - "13447": 1, - "13507": 1, - "13508": 0, - "13597": 0, - "13598": 0, - "13619": 2, - "13622": 1, - "13674": 1, - "13836": 0, - "14128": 0, - "14130": 0, - "14144": 2, - "14304": 2, - "14314": 0, - "14627": 1, - "14740": 2, - "14932": 0, - "14944": 0, - "14952": 1, - "15035": 0, - "15277": 0, - "15756": 1, - "16751": 0, - "17066": 1, - "17381": 1, - "17405": 1, - "17406": 1, - "17414": 1, - "17415": 1, - "17416": 1, - "17417": 1, - "17430": 1, - "17444": 0, - "17451": 0, - "17457": 1, - "17462": 1, - "17603": 1, - "17604": 1, - "17605": 0, - "17606": 0, - "17762": 1, - "17764": 1, - "17765": 1, - "17768": 0, - "17769": 1, - "17992": 2, - "18149": 1, - "18153": 1, - "18204": 1, - "18222": 2, - "18524": 1, - "18845": 1, - "19027": 1, - "19148": 1, - "19149": 1, - "19188": 1, - "19398": 2, - "19467": 1, - "19859": 1, - "19900": 1, - "19902": 2, - "20037": 1, - "20196": 1, - "20240": 1, - "20282": 2, - "20575": 1 - } -} +{"regulation": {"5195": 0, "11195": 0, "7601": 0, "5868": 0, "12108": 0, "9957": 0, "12080": 0, "4095": 0, "11518": 0, "4518": 0, "11207": 0, "8472": 0, "17768": 0, "13508": 0, "17606": 0, "17605": 0, "15277": 0, "16751": 0, "8733": 0, "11932": 0, "14130": 0, "14128": 0, "10354": 0, "12960": 0, "12786": 0, "17451": 0, "9742": 0, "6654": 0, "11344": 0, "17444": 0, "4426": 0, "5477": 0, "13836": 0, "13598": 0, "13597": 0, "7386": 0, "11651": 0, "9860": 0, "11296": 0, "5371": 0, "8318": 0, "8159": 0, "12412": 0, "14944": 0, "8085": 0, "5657": 0, "7435": 0, "7714": 0, "12642": 0, "14932": 0, "9821": 0, "15035": 0, "6885": 0, "8440": 0, "5433": 0, "4901": 0, "4900": 0, "5605": 0, "4911": 0, "4907": 0, "4844": 0, "6458": 0, "5906": 0, "5123": 0, "11159": 0, "5127": 0, "5724": 0, "4812": 0, "5389": 0, "4966": 0, "4910": 0, "14314": 0, "5671": 0, "5539": 0, "4885": 0, "6078": 0, "9153": 0, "5399": 0, "4960": 0, "7652": 0, "5945": 0, "5446": 0, "4851": 0, "6444": 0, "6708": 0, "5406": 0, "12906": 1, "20575": 1, "19188": 1, "17769": 1, "19148": 1, "17604": 1, "12070": 1, "12074": 1, "17765": 1, "17430": 1, "17603": 1, "12788": 1, "12749": 1, "9256": 1, "19149": 1, "19467": 1, "17406": 1, "17405": 1, "20572": 1, "11529": 1, "14952": 1, "18153": 1, "17415": 1, "17416": 1, "17414": 1, "17417": 1, "9554": 1, "19859": 1, "14740": 1, "10216": 1, "7673": 1, "17764": 1, "18149": 1, "17762": 1, "20037": 1, "4027": 1, "4024": 1, "4026": 1, "4023": 1, "4025": 1, "12433": 1, "13507": 1, "20584": 1, "20196": 1, "17462": 1, "9778": 1, "6901": 1, "18845": 1, "4891": 1, "5236": 1, "19027": 1, "15756": 1, "5846": 1, "19900": 1, "19196": 1, "4842": 1, "17457": 1, "20282": 1, "13674": 1, "5328": 1, "4821": 1, "5537": 1, "20240": 1, "12801": 1, "4678": 1, "6161": 1, "11840": 1, "12978": 1, "9271": 1, "14627": 1, "18204": 1, "7570": 1, "17066": 1, "17381": 1, "8602": 1, "8197": 1, "5622": 1, "7934": 1, "5740": 1, "13447": 1, "13107": 1, "13622": 1, "4913": 2, "12047": 2, "9455": 2, "17992": 2, "12800": 2, "7747": 2, "14144": 2, "12465": 2, "7445": 2, "19902": 2, "13619": 2, "18524": 2, "14304": 2, "18222": 2}}
\ No newline at end of file diff --git a/data/cn-genbanlist.py b/data/cn-genbanlist.py index c80d7f0..6167990 100644 --- a/data/cn-genbanlist.py +++ b/data/cn-genbanlist.py @@ -1,4 +1,5 @@ import json +import urllib.request cardId = dict() cards = None @@ -15,6 +16,31 @@ for k in cards: if 'sc_name' not in cards[k]: result['ban'].append(str(cardId[k])) + +def transform_card_data(input_json): + output_data = {"regulation": {}} + for item in input_json["list"]: + for card in item["list"]: + card_no = card["cardNo"] + forbidden_type = card["type"] + if "禁止卡" == forbidden_type: + output_data["regulation"][card_no] = 0 + elif "限制卡" == forbidden_type: + output_data["regulation"][card_no] = 1 + elif "准限制卡" == forbidden_type: + output_data["regulation"][card_no] = 2 + return output_data + +url = "https://yxwdbapi.windoent.com/forbiddenCard/forbiddencard/cachelist?groupId=1" + +source_data = "" +with urllib.request.urlopen(url) as response: + data = response.read().decode('utf-8') + source_data = json.loads(data) + +with open('banlist-cn.json', 'w') as fp: + json.dump(transform_card_data(source_data), fp) + banlist = None with open('banlist-cn.json', 'r') as fp: banlist = json.load(fp) @@ -29,5 +55,6 @@ for cid in regulation: if regulation[cid] == 2: result['semiLimit'].append(sid) result['ban'] = list(set(result['ban'])) -print(json.dumps(result, indent=4)) +print(json.dumps(result, indent=4)) + diff --git a/data/fetch-ocg-banlist.py b/data/fetch-ocg-banlist.py new file mode 100644 index 0000000..0da0110 --- /dev/null +++ b/data/fetch-ocg-banlist.py @@ -0,0 +1,35 @@ +import json +import urllib.request +import re + +url = "https://www.db.yugioh-card.com/yugiohdb/forbidden_limited.action?request_locale=ja" + +source_data = "" +with urllib.request.urlopen(url) as response: + data = response.read().decode('utf-8') + +current_status = -1 + +output_data = {"regulation": {}} + +for line in data.split('\n'): + if '</div><!-- #list_semi_limited .list_set -->' in line: + current_status = -1 + if '<div id="list_semi_limited" class="list_set">' in line: + current_status = 2 + if '<div id="list_forbidden" class="list_set">' in line: + current_status = 0 + if '<div id="list_limited" class="list_set">' in line: + current_status = 1 + + pattern = r'<input type="hidden" class="link_value" value="/yugiohdb/card_search\.action\?ope=\d+&cid=(\d+)">' + match = re.search(pattern, line) + if match and current_status >= 0: + cid = match.group(1) + output_data["regulation"][cid] = current_status + + +with open('banlist.json', 'w') as fp: + json.dump(output_data, fp) + + diff --git a/data/fetch-tcg-banlist.py b/data/fetch-tcg-banlist.py new file mode 100644 index 0000000..197b9c3 --- /dev/null +++ b/data/fetch-tcg-banlist.py @@ -0,0 +1,35 @@ +import json +import urllib.request +import re + +url = "https://www.db.yugioh-card.com/yugiohdb/forbidden_limited.action?request_locale=en" + +source_data = "" +with urllib.request.urlopen(url) as response: + data = response.read().decode('utf-8') + +current_status = -1 + +output_data = {"regulation": {}} + +for line in data.split('\n'): + if '</div><!-- #list_semi_limited .list_set -->' in line: + current_status = -1 + if '<div id="list_semi_limited" class="list_set">' in line: + current_status = 2 + if '<div id="list_forbidden" class="list_set">' in line: + current_status = 0 + if '<div id="list_limited" class="list_set">' in line: + current_status = 1 + + pattern = r'<input type="hidden" class="link_value" value="/yugiohdb/card_search\.action\?ope=\d+&cid=(\d+)">' + match = re.search(pattern, line) + if match and current_status >= 0: + cid = match.group(1) + output_data["regulation"][cid] = current_status + + +with open('banlist-tcg.json', 'w') as fp: + json.dump(output_data, fp) + + diff --git a/data/update.sh b/data/update.sh index d9b5594..fc49393 100644 --- a/data/update.sh +++ b/data/update.sh @@ -4,6 +4,10 @@ unzip cards.zip rm cards.zip python3 build-card-info.py python3 split.py + +python3 fetch-ocg-banlist.py +python3 fetch-tcg-banlist.py + python3 genbanlist.py > ../src/ocg_banlist.json python3 cn-genbanlist.py > ../src/cnocg_banlist.json python3 tcg-genbanlist.py > ../src/tcg_banlist.json @@ -12,3 +16,8 @@ python3 md-genbanlist.py > ../src/md_banlist.json rsync -avz ./card_db_parts/ root@raye:/volume/webroot/card_db_parts/ cd .. sh deploy.sh + +cd data +cp cards.json ~/ygo/cardtext-proj +cd ~/ygo/cardtext-proj +sh update.sh |
