騰訊圍棋分享出來的鏈接:
其實棋譜就在這一串書數字裏,懶得去解析,可以直接分析網頁源代碼。
通過源代碼就能看出每顆棋子的位置。
用Tampermonkey寫一個腳本,就可以得到對應的棋譜了。
// ==UserScript==
// @name 騰訊圍棋轉譜
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://huanle.qq.com/act/*
// @grant none
// @require http://code.jquery.com/jquery-1.11.0.min.js
// ==/UserScript==
(function() {
'use strict';
setTimeout(function () { load(); }, 2000);
$(".comment_title1").append("<textarea id='qp' style='width:100%;height:100px'>棋譜生成中...</textarea>");
function load() {
var arr = "ABCEDFGHIJKLMNOPQRS";
var res = "(";
$("#gameView div").each(function () {
var left = $(this).css("left").replace("px", "") - 19;
var top = $(this).css("top").replace("px", "") - 19;
var x = arr[left / 38].toLowerCase();
var y = arr[top / 38].toLowerCase();
var c = $(this).attr("class") == "chessBlack" ? "B" : "W";
res += (c + "[" + x + y + "]") + ";"
});
res = res.substring(0, res.length - 1) + ")";
$("#qp").val( res);
}
})();
執行效果