Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Options::get is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/class-module-view.php on line 131
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::default_options is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-options.php on line 48
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::settings is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 188
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Functions::exists_push7 is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 129
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::sns_list is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/class-module-shortcode.php on line 218
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::default_options is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 206
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::settings is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 188
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Functions::exists_push7 is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 129
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Functions::get_current_url is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/class-module-shortcode.php on line 219
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::notification_list is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/class-module-shortcode.php on line 251
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::default_options is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 232
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Variable::settings is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 188
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Functions::exists_push7 is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 129
Deprecated: Calling static trait method VASOCIALBUZZ\Modules\Functions::exists_push7 is deprecated, it should only be called on a class using the trait in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/plugins/va-social-buzz/incs/trait-variables.php on line 235
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/amp.php on line 38
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/amp.php on line 38
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/amp.php on line 38
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/amp.php on line 38
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/amp.php on line 38
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/amp.php on line 38
かなり久々にTwitterのbotを作ってハマったので。Twitter APIでbotを作った時のエラー回避方法です。
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/customizer.php on line 4923
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/freesim.tokyo/httpdocs/wp-content/themes/simplicity2/lib/customizer.php on line 4929
目次
Twitter APIのエラー:Error Code 226 – This request looks like it might be automated の回避方法
Twitterのbotで一定時間でツイートをするbotを作ると高確率で「Error Code 226 – This request looks like it might be automated」でツイートが止まります。
以前は普通に出来たのにな・・・と思いながら色々調べると、様々な解決方法が提示されていましたが、結局思い出して自己解決しました。
ネットで見つけた回避案
この手のエラーにハマるとまぁみんなやることが、エラーメッセージで検索しますよね。
ちなみにエラーはこんなのです。
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[code] => 226
[message] => This request looks like it might be automated. To protect our users from spam and other malicious activity, we can't complete this action right now. Please try again later.
)
)
)
要はbotでツイートばっかりしてるとSPAMっぽいから止めちゃうよ、という内容。
前にやっていた方法を忘れていたので、とりあえずエラーメッセージで解決法を検索してみました。
挙がっていたのはこういったもの。
- ハッシュが多いとSPAM扱いされるのでハッシュを減らしましょう
- cronなどの間隔を空ける
- https://support.twitter.com/forms/platformでSPAMではないことを弁明する
別にどれも間違ってるとも思いませんが、これで問題が解決するか?というと多分あまり効果はないと思います。
Twitter APIのError226回避方法
要は同じような事を自動でツイートしているとSPAMっぽいから止めるよ、というエラー内容なので、それに合った対策をすればOK。
Twitterは手動でもAPI経由でも、全く同じ内容のツイートの連続投稿を止めるようになっています。
手動でTwitterにポストして多重クリックで止められたことってないですか?
Twitter側でツイートするアカウントの以前のアカウントを数ツイートチェックして、全く同じなら弾いてるだけなんです、これ。
ということは・・・なんでもいいのでタイミングで変わる内容をツイートに付加してあげれば基本このエラーは回避できます。
PHPで書くならrand()でもいいし、microtime()使ってもいいいし・・・。
スペースを任意の数追加するだけでもある程度までいけます。
けれどスペースの数を1から10までやっても10パターンしか取れないし、ただでさえ文字数制限のあるTwitterですから、あまり余計な文字列は入れたくない・・・そうすると、一番バリエーションが取れるのはなんだっけ?って話ですね。
具体的なコードを書くとSPAM助長と取られかねないので書きませんが、そういう方法で思った以上に簡単にこのエラーは回避できます。