@no_TL I tried to write English articles about the GAB for the Japanese!
(Disclaimer: The following have been tested by https://gab.com/apuz_zill etc, But I'm sorry with my poor English because I can't assume any responsibility even if it causes problems. Please feel free to 略)
0: GAB has Rewrite feature, Quote toot and Groups function (Differ the usual mastodon)
To use GAB with many English speakers, I needed to filter the language settings (preferably only ja) so that Japanese is properly displayed later.
1: A PHP script that allows me to look the federation timeline comfortably
Basically, GAB (like Mastodon unlike Twitter) can easily use the REST API with an ACCESS_TOKEN. And now, below is what I call self-closed mode.
1.1: Get ACCESS_TOKEN
ACCESS_TOKEN can be created by “New application” in the GAB, this is used at the following like a $atoken = "--header 'Authorization: Bearer ACCESS_TOKEN'";
.
1.2: Example using cURL
Let's set manually “Mute with notification” to some accounts that you don't want to process automatically (the default in Mute API is no notification). For example, it is recommended to process non-Japanese with the following PHP script for setting Block or Domain_blocks at “All Fediverse”.
<?php $atoken = "--header 'Authorization: Bearer ACCESS_TOKEN'";
$myhost = 'https://gab.com'; $epoint = $myhost. '/api/v1/timelines/public';
$queryc = "curl -X GET -sS ${epoint} -d 'limit=2' ${atoken}";
for ($i=0; $i<2; $i++) {
$jarray = json_decode(`$queryc`, JSON_OBJECT_AS_ARRAY);
foreach($jarray as $key => $value){
$domain = preg_split("/\@/", $value['account']['acct']);
if ( (! isset($jarray['error'])) && (! strstr($domain[0], 'apuz_zill')) ) { // without me
if (strstr($domain[1], 'fedibird.com')) { // Follower's etc
$epoint_ = $myhost. '/api/v1/accounts/'. $value['account']['id']. '/block';
$queryc_ = "curl -X POST -sS ${epoint_} ${atoken}";
$jarray_ = json_decode(`$queryc_`, JSON_OBJECT_AS_ARRAY);
echo "\n<h1>block: ". $value['account']['acct']. "</h1>\n". $value['created_at'];
} elseif (! empty($domain[1]) ) { // Other Instances
$epoint_ = $myhost. '/api/v1/domain_blocks';
$domain_ = "-d 'domain=". $domain[1]. "'";
$queryc_ = "curl -X POST -sS ${epoint_} ${domain_} ${atoken}";
$jarray_ = json_decode(`$queryc_`, JSON_OBJECT_AS_ARRAY);
echo "\n<h1>domain_blocks: ". $value['account']['acct']. "</h1>\n". $value['created_at'];
} elseif ( strstr($value['language'], 'ja') ) { // Temporary Mutes
$epoint_ = $myhost. '/api/v1/accounts/'. $value['account']['id']. '/mute';
$queryc_ = "curl -X POST -sS ${epoint_} ${atoken}";
$jarray_ = json_decode(`$queryc_`, JSON_OBJECT_AS_ARRAY);
echo "\n<h1>mute: ". $value['account']['acct']. "</h1>\n". $value['created_at'];
} else { // These posts aren't Japanese in the GAB
$epoint_ = $myhost. '/api/v1/accounts/'. $value['account']['id']. '/block';
$queryc_ = "curl -X POST -sS ${epoint_} ${atoken}";
$jarray_ = json_decode(`$queryc_`, JSON_OBJECT_AS_ARRAY);
echo "\n<h1>block: ". $value['account']['acct']. "</h1>\n". $value['created_at'];
}
}
if ( isset($jarray['error']) || isset($jarray_['error']) ) {
break;
}
}
if ( isset($jarray['error']) || isset($jarray_['error']) ) {
echo "\n<p>たぶんAPI制限です。</p>\n";
break;
}
}
?><!-- クソ.php ここまで -->
(注:私が主に使っているレンタルサーバのロリポップにおいて、先週ぐらいから突然PHP7のstrposが使えなくなったようで、一時的にstrstrを使っております。)
1.3: ハイもう英語制限解除で~
Chrome Extension “Talend API Tester”等で簡単にAPI試せるとか、色々な例でのコードを以下別頁にもUPしつつ記載する予定未定。ちなみにPawoo用ギリメカラでは下記のようなPHPスクリプトを20分毎にやったぉ(API制限が厳しいため)。
<?php $atoken = "--header 'Authorization: Bearer ACCESS_TOKEN'";
$myhost= 'https://pawoo.net'; $epoint='/api/v1/accounts/110167/statuses';
$queryo = "curl -X POST -sS ${myhost}${epoint} -d 'limit=30' ${atoken}";
$jarray = json_decode(`$queryo`, JSON_OBJECT_AS_ARRAY);
foreach ($jarray as $key => $value) {
$epoint_='/api/v1/statuses/'. $value['id'];
$queryo = "curl --request DELETE -sS ${myhost}${epoint_} ${atoken}";
var_dump(`$queryo`);
}
?><!-- pawoo.php ここまで -->
2: 参考サイト備忘録枠
[「PHPおよびjsonデータを使用したcURL API呼び出し(GET POST PUT DELETE)」 https://weichie.com/blog/curl-api-calls-with-php/ ] マストドン・プレロマ・ハブジラ・フレンディカ・ミスほか略
Thank you and best regards
皆様の御蔭様で今年も生きれており幸せです(追記1月3日)。そういえば、メイスキというゴミスキ鯖にはアカウント削除&IPアクセス拒否に無事して頂きました@hallo@misskey.m544.net">笑、自らチャンスに蓋をし仲良しゴッコ大将に酔うなら何の感慨もなく深い不快