mingchuno/golden-cache

高登api endpoint && api key提供

Saren-Arterius opened this issue · 22 comments

API 1使用者: datHKG, ArcHKG (可能仲有ios 官方app)
API 2使用者: datHKG, 官方app

Topic list (GET): http://android-1-{{server 1/2}}.hkgolden.com/newTopics.aspx?s={{api_key}}&user_id={{user_id}}&type={{forum 如 BW HW}}&block={{hide_blocked_members 隱藏已封鎖會員 Y/N}}&page={{page}}&filtermode={{forum_filter 小圈子過濾 Y/N}}&sensormode=N&returntype=json

View post (POST, 請將所有GET param轉做POST param): http://android-1-{{server}}.hkgolden.com/newView.aspx?s={{api_key}}&user_id={{user_id}}&message={{topic_id}}&start={{start 由第n個reply開始}}&limit={{limit 讀幾多個reply (sql limit)}}&filtermode=N&sensormode=N&returntype=json

server = 1, (general) api key: md5("{{yyyymmdd}}_HKGOLDEN_{{user_id}}_$API#1.3^")
server = 2, (topic list) api key: md5("{{yyyymmdd}}_HKGOLDEN_{{user_id}}_$API#Android_1_2^{{forum 如 BW HW}}_{{page 如 1 2}}_{{小圈子過濾 Y/N}}_N")
server = 2, (view topic) api key: md5("{{yyyymmdd}}_HKGOLDEN_{{user_id}}_$API#Android_1_2^{{topic_id}}_{{start param既數字}}_N_N")
server = 2, (general) api key: md5("{{yyyymmdd}}_HKGOLDEN_{{user_id}}_$API#Android_1_2^")

user_id可以代0或者random都得
兩個api key一到00:00就唔work,要睇返高登server時差

感謝, 依家1st piority 應該係搞好個UI同埋buf fix

我唔識angular 幫唔到手 sosad

ui有冇試過materialize?

完全唔識frontend, 試個下個Angular Material, 搞佢唔點.....:0)

禾刀系半桶水,我又係唔識scala soasd

今晚幫手當學下野先

唔一定要Angular, 我都係是但簡當學下. 有idea welcome 提供
試個下Polymer, 太新, FF 唔work [sosad]
開個新issue先

比我搞,遲早變網頁版dathkg sosad

都唔錯丫

想寫個react native,依家api 仲work 唔work ?

@mike623 我唔係直接用上面既API,我都係是但用左2條,不過上面既應該都work既

點解唔用上面兩條 API?http://apps.hkgolden.com 有 d icons 出唔到 (食鬼之類)

關事咩?api返黎係html,我要出到的icon就要對應既relative path 有的圖係到

似係 apps.hkgolden.com 個 conversation 唔夠 update。
例如呢個

http://apps.hkgolden.com/android_api/v_1_0/newView.aspx?message=6271868&returntype=json&filtermode=N&sensormode=N&page=22

當中有句:

仲可以換做水箭龜 \u003cimg src="/faces/bomb.gif" alt="[bomb]" border="0" /\u003eg \r\u003cbr /\u003e

你見個 icon 係 bomb.gif 再加個 g 結尾,去番網頁版睇會見到係食鬼 bomb。即係個 icon code 係 [bombg]。但 apps.hkgolden.com 個 API 唔識轉去 ghost/bomb.gif。Saren-Arterius 提供的 API 則無此問題。

理論上可以抽返img alt入面既[bomb]出黎變返做文字,令到[bomb]同g痴埋一齊變[bomb]g,再跟優先次序render返[bomb]g做食鬼icon
但唔係100% work...

呢段都唔係好work...

private void repairOldApiIcons() {
    synchronized (locks[9]) {
        if (lookupMap == null) {
            lookupMap = new HashMap<>();
            for (HKGInternalIcon icon : HKGInternalIcon.values()) {
                if (icon.getIconType() != HKGInternalIconType.HKGOLDEN) {
                    lookupMap.put(icon.getBBCode(), icon);
                }
            }
        }
    }
    synchronized (baseDocument) {
        for (Element img : baseDocument.select("img")) {
            if (img.attr("alt").startsWith("[img]")) {
                continue;
            }
            if (!(img.nextSibling() instanceof TextNode)) {
                continue;
            }
            TextNode tn = (TextNode) img.nextSibling();
            int index = tn.text().indexOf(" ", 1);
            if (index != -1) {
                tn.splitText(index);
            }
            String lookup = img.attr("alt") + tn;
            HKGInternalIcon icon = lookupMap.get(lookup.trim());
            if (icon == null) {
                continue;
            }
            img.attr("alt", icon.getBBCode());
            img.attr("src", "/" + icon.getAssetPath());
            if (lookup.charAt(lookup.length() - 1) == ' ') {
                tn.text(" ");
            } else {
                tn.remove();
            }
        }
    }
}

@goofyz 明白,不過eventually 都係要我個site有個堆icon, right?

@Saren-Arterius 寫咁多我覺得用新API 好 d。定係舊API 有其他好處?

@mingchuno 當然啦,不過呢 part 好易解決。貓叉都可以提供啦 #yup# 。我只係覺得用新 API 唔駛咁煩 o者。

@goofyz 舊api既好處就係得個快字 :o)

@Saren-Arterius @goofyz 我無乜所謂,不過快同易用都好緊要。

更正,server 1 api key係

md5("{{yyyymmdd}}HKGOLDEN{{user_id}}_$API1.3^")

多左個#,刪返

當我冇講過上面

how about the api interface for search?