src/Tweeper.php: set User-Agent to impersonate a Google crawler
authorAntonio Ospite <ao2@ao2.it>
Thu, 24 Dec 2020 09:04:59 +0000 (10:04 +0100)
committerAntonio Ospite <ao2@ao2.it>
Thu, 24 Dec 2020 09:04:59 +0000 (10:04 +0100)
Set User-Agent to impersonate a Google crawler, this makes twitter.com
return the old desktop UI which can be more easily scraped.

This restore brings back support for twitter.com which has stopped
serving the mobile UI which was still scrapeable somehow.

src/Tweeper.php

index 9dc1381..4a32f56 100644 (file)
@@ -36,7 +36,7 @@ date_default_timezone_set('UTC');
  */
 class Tweeper {
 
  */
 class Tweeper {
 
-  private static $userAgent = "Mozilla/5.0";
+  private static $userAgent = "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)";
   private static $maxConnectionTimeout = 5;
   private static $maxConnectionRetries = 5;
 
   private static $maxConnectionTimeout = 5;
   private static $maxConnectionRetries = 5;