From eeaa8cdf1c9c653c0907cc62245c22d1342847c4 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Sun, 5 Mar 2023 13:18:34 +0100 Subject: [PATCH] Random User Agent generator --- app/Helpers/Wrappers.php | 6 ++- composer.lock | 90 +++++++++++++++++++++++++++++----------- 2 files changed, 71 insertions(+), 25 deletions(-) diff --git a/app/Helpers/Wrappers.php b/app/Helpers/Wrappers.php index 149e00e..90a505c 100644 --- a/app/Helpers/Wrappers.php +++ b/app/Helpers/Wrappers.php @@ -164,7 +164,11 @@ class Wrappers { } } - $options["user_agent"] = Misc::env("USER_AGENT", TikScraperUserAgents::DEFAULT); + $customUa = Misc::env("USER_AGENT", ''); + + if ($customUa) { + $options['user_agent'] = $customUa; + } return new \TikScraper\Api($options, $cacheEngine); } diff --git a/composer.lock b/composer.lock index 60d2536..e91edaa 100644 --- a/composer.lock +++ b/composer.lock @@ -57,6 +57,46 @@ }, "time": "2021-11-18T19:24:07+00:00" }, + { + "name": "deemon47/user-agent-generator", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Deemon47/user-agent-generator.git", + "reference": "5af13fd2e905c5441eb4d61aad3a71bd1e801709" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Deemon47/user-agent-generator/zipball/5af13fd2e905c5441eb4d61aad3a71bd1e801709", + "reference": "5af13fd2e905c5441eb4d61aad3a71bd1e801709", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Deemon47\\": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0-only" + ], + "authors": [ + { + "name": "phpfail", + "email": "phpfail@gihub.com" + }, + { + "name": "Dee", + "email": "deemon47@gmail.com" + } + ], + "description": "Generate random User-Agent http header with parameters", + "support": { + "source": "https://github.com/Deemon47/user-agent-generator/tree/v1.0.1" + }, + "time": "2020-04-11T12:05:34+00:00" + }, { "name": "josegonzalez/dotenv", "version": "dev-master", @@ -263,19 +303,20 @@ }, { "name": "pablouser1/tikscraper", - "version": "v2.3.4.1", + "version": "v2.3.5.0", "source": { "type": "git", "url": "https://github.com/pablouser1/TikScraperPHP.git", - "reference": "4426ee91c13b4661fd11e1d3f4b5da33c64fbc75" + "reference": "825b486fa07832a4ee694739ca4ffdb67c392fb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/4426ee91c13b4661fd11e1d3f4b5da33c64fbc75", - "reference": "4426ee91c13b4661fd11e1d3f4b5da33c64fbc75", + "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/825b486fa07832a4ee694739ca4ffdb67c392fb8", + "reference": "825b486fa07832a4ee694739ca4ffdb67c392fb8", "shasum": "" }, "require": { + "deemon47/user-agent-generator": "^1.0", "ext-curl": "*", "ext-json": "*", "ext-xml": "*", @@ -305,43 +346,44 @@ "description": "Get data from TikTok API", "support": { "issues": "https://github.com/pablouser1/TikScraperPHP/issues", - "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.4.1" + "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.5.0" }, - "time": "2023-01-28T16:31:29+00:00" + "time": "2023-03-05T12:17:33+00:00" }, { "name": "php-webdriver/webdriver", - "version": "1.13.1", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "6dfe5f814b796c1b5748850aa19f781b9274c36c" + "reference": "3ea4f924afb43056bf9c630509e657d951608563" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/6dfe5f814b796c1b5748850aa19f781b9274c36c", - "reference": "6dfe5f814b796c1b5748850aa19f781b9274c36c", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/3ea4f924afb43056bf9c630509e657d951608563", + "reference": "3ea4f924afb43056bf9c630509e657d951608563", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-zip": "*", - "php": "^5.6 || ~7.0 || ^8.0", + "php": "^7.3 || ^8.0", "symfony/polyfill-mbstring": "^1.12", - "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0 || ^6.0" + "symfony/process": "^5.0 || ^6.0" }, "replace": { "facebook/webdriver": "*" }, "require-dev": { - "ondram/ci-detector": "^2.1 || ^3.5 || ^4.0", + "ergebnis/composer-normalize": "^2.20.0", + "ondram/ci-detector": "^4.0", "php-coveralls/php-coveralls": "^2.4", - "php-mock/php-mock-phpunit": "^1.1 || ^2.0", + "php-mock/php-mock-phpunit": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9", + "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "^3.5", - "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0 || ^6.0" + "symfony/var-dumper": "^5.0 || ^6.0" }, "suggest": { "ext-SimpleXML": "For Firefox profile creation" @@ -370,9 +412,9 @@ ], "support": { "issues": "https://github.com/php-webdriver/php-webdriver/issues", - "source": "https://github.com/php-webdriver/php-webdriver/tree/1.13.1" + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.14.0" }, - "time": "2022-10-11T11:49:44+00:00" + "time": "2023-02-09T12:12:19+00:00" }, { "name": "sapistudio/seleniumstealth", @@ -572,16 +614,16 @@ }, { "name": "symfony/process", - "version": "v5.4.19", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1" + "reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c5ba874c9b636dbccf761e22ce750e88ec3f55e1", - "reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1", + "url": "https://api.github.com/repos/symfony/process/zipball/d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd", + "reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd", "shasum": "" }, "require": { @@ -614,7 +656,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.19" + "source": "https://github.com/symfony/process/tree/v5.4.21" }, "funding": [ { @@ -630,7 +672,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-02-21T19:46:44+00:00" } ], "packages-dev": [],