From: Antonio Ospite <ao2@ao2.it>
Date: Thu, 24 Dec 2020 09:04:59 +0000 (+0100)
Subject: src/Tweeper.php: set User-Agent to impersonate a Google crawler
X-Git-Tag: v1.4.3~3
X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/357d7a4955830d690a16d52a6f91e351c813ab48?ds=sidebyside;hp=ae19a2f4361fbac5cd4d393291c6c088265e9647

src/Tweeper.php: set User-Agent to impersonate a Google crawler

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.
---

diff --git a/src/Tweeper.php b/src/Tweeper.php
index 9dc1381..4a32f56 100644
--- a/src/Tweeper.php
+++ b/src/Tweeper.php
@@ -36,7 +36,7 @@ date_default_timezone_set('UTC');
  */
 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;