]> git.sur5r.net Git - minitube/blobdiff - src/httputils.cpp
Upload 3.9.3-2 to unstable
[minitube] / src / httputils.cpp
index d522f6e3423e9c2fad7e3fcbad6571ea88ac1a94..6393fe3e0018e74159ce55bf2afe05623359bfba 100644 (file)
@@ -3,7 +3,6 @@
 #include "constants.h"
 #include "http.h"
 #include "localcache.h"
-#include "throttledhttp.h"
 
 Http &HttpUtils::notCached() {
     static Http *h = [] {
@@ -33,13 +32,23 @@ Http &HttpUtils::yt() {
         http->addRequestHeader("User-Agent", stealthUserAgent());
 
         CachedHttp *cachedHttp = new CachedHttp(*http, "yt");
-        cachedHttp->setMaxSeconds(3600);
+        cachedHttp->setMaxSeconds(86400);
 
         return cachedHttp;
     }();
     return *h;
 }
 
+Http &HttpUtils::stealthAndNotCached() {
+    static Http *h = [] {
+        Http *http = new Http;
+        http->addRequestHeader("User-Agent", stealthUserAgent());
+
+        return http;
+    }();
+    return *h;
+}
+
 void HttpUtils::clearCaches() {
     LocalCache::instance("yt")->clear();
     LocalCache::instance("http")->clear();
@@ -56,6 +65,8 @@ const QByteArray &HttpUtils::userAgent() {
 }
 
 const QByteArray &HttpUtils::stealthUserAgent() {
-    static const QByteArray ua = "curl/7.37.0";
+    static const QByteArray ua =
+            "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like "
+            "Gecko) Chrome/84.0.4147.105 Safari/537.36";
     return ua;
 }