H::H spam keywords

    @@ -1,10 +1,9 @@ /* * @title H::H spam keywords - * @description show Hatena Haiku spam keywords - * @include http://h.hatena.ne.jp/* + * @description get Hatena Haiku spam keywords abstract + * @include *://h.hatena.ne.jp/* * @license MIT License https://opensource.org/licenses/MIT * @javascript_url - * @private waiting response http://h.hatena.ne.jp/noromanba/81808837725569071 */ // spam filter @@ -13,23 +12,53 @@ // via // http://h.hatena.ne.jp/austinburk/81808835637056449 +// http://h.hatena.ne.jp/austinburk/4623530768743273059 + +// for "Hot Keyword" at right side e.g. +// http://h.hatena.ne.jp +// or "Related Keywords" by topics e.g. +// http://h.hatena.ne.jp/target?word=mail (async () => { 'use strict'; - const API = 'https://haikuantispam.lightni.ng/api/recent_keywords.json'; + // Access-Control-Allow-Origin: http://h.hatena.ne.jp + const KEYWORD_FILTER = 'https://haikuantispam.lightni.ng/api/recent_keywords.json'; + // returns + // { { - const res = await fetch(API, { referrer: 'no-referrer', credentials: 'omit', }); + // https://html.spec.whatwg.org/#cors-settings-attributes + const res = await fetch(KEYWORD_FILTER, { + // https://fetch.spec.whatwg.org/#request-headers + // https://html.spec.whatwg.org/#initialise-the-document-object + cache: 'no-cache', + credentials: 'omit', + mode: 'cors', + // Referrer-Policy fallback + referrer: '', + // https://w3c.github.io/webappsec-referrer-policy/#referrer-policies + // https://fetch.spec.whatwg.org/#concept-request-referrer-policy + // https://developer.mozilla.org/en-US/docs/Web/API/Request/referrerPolicy + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy + referrerPolicy: 'no-referrer', + }); const json = await res.json(); - const positives = Object.entries(json).filter(([keyword, score]) => score >= 5); - console.table(positives); + const ordereds = Object.entries(json) + .sort(([, score], [, zcore]) => score - zcore); + console.dir(ordereds); } { - const res = await fetch(API, { referrer: 'no-referrer', credentials: 'omit', }); + const res = await fetch(KEYWORD_FILTER, { + cache: 'no-cache', + credentials: 'omit', + mode: 'cors', + referrer: '', + referrerPolicy: 'no-referrer', + }); const json = await res.json(); - const ordereds = Object.entries(json).sort((a, b) => a[1] - b[1]); - console.table(ordereds); + const positives = Object.entries(json).filter(([keyword, score]) => score >= 5); + console.table(positives); } })();
  • /*
     * @title H::H spam keywords
     * @description get Hatena Haiku spam keywords abstract
     * @include *://h.hatena.ne.jp/*
     * @license MIT License https://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    // spam filter
    // http://let.hatelabo.jp/noromanba/let/hJmc6brdnsgL
    
    
    // via
    // http://h.hatena.ne.jp/austinburk/81808835637056449
    // http://h.hatena.ne.jp/austinburk/4623530768743273059
    
    // for "Hot Keyword" at right side e.g.
    // http://h.hatena.ne.jp
    // or "Related Keywords" by topics e.g.
    // http://h.hatena.ne.jp/target?word=mail
    (async () => {
        'use strict';
    
        // Access-Control-Allow-Origin: http://h.hatena.ne.jp
        const KEYWORD_FILTER = 'https://haikuantispam.lightni.ng/api/recent_keywords.json';
        // returns
        // {
    
        {
            // https://html.spec.whatwg.org/#cors-settings-attributes
            const res = await fetch(KEYWORD_FILTER, {
                // https://fetch.spec.whatwg.org/#request-headers
                // https://html.spec.whatwg.org/#initialise-the-document-object
                cache: 'no-cache',
                credentials: 'omit',
                mode: 'cors',
                // Referrer-Policy fallback
                referrer: '',
                // https://w3c.github.io/webappsec-referrer-policy/#referrer-policies
                // https://fetch.spec.whatwg.org/#concept-request-referrer-policy
                // https://developer.mozilla.org/en-US/docs/Web/API/Request/referrerPolicy
                // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
                referrerPolicy: 'no-referrer',
            });
            const json = await res.json();
            const ordereds = Object.entries(json)
                .sort(([, score], [, zcore]) => score - zcore);
            console.dir(ordereds);
        }
    
        {
            const res = await fetch(KEYWORD_FILTER, {
                cache: 'no-cache',
                credentials: 'omit',
                mode: 'cors',
                referrer: '',
                referrerPolicy: 'no-referrer',
            });
            const json = await res.json();
            const positives = Object.entries(json).filter(([keyword, score]) => score >= 5);
            console.table(positives);
        }
    
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/07/24 09:15:35 - 2018-07-24
  2. 2018/07/23 06:39:21 - 2018-07-23
  3. 2018/07/23 06:34:59 - 2018-07-23
  4. 2018/07/22 08:18:57 - 2018-07-22
  5. 2018/07/20 09:04:35 - 2018-07-20