mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-29 03:47:42 +01:00
feat: extract curl ua to config value (#2568)
* exclude config.default.ini.php from phpcs
This commit is contained in:
parent
42788cd3ee
commit
bed20e9f28
@ -229,7 +229,7 @@ EOD
|
||||
|
||||
$ctx = stream_context_create(array(
|
||||
'http' => array(
|
||||
'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0',
|
||||
'user_agent' => Configuration::getConfig('http', 'useragent'),
|
||||
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
||||
)
|
||||
)
|
||||
@ -254,7 +254,7 @@ EOD
|
||||
|
||||
$context = stream_context_create(array(
|
||||
'http' => array(
|
||||
'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0',
|
||||
'user_agent' => Configuration::getConfig('http', 'useragent'),
|
||||
'header' => 'Cookie: ' . $cookies
|
||||
)
|
||||
)
|
||||
|
@ -25,8 +25,6 @@ class MixCloudBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
ini_set('user_agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0');
|
||||
|
||||
$html = getSimpleHTMLDOM(self::URI . '/' . $this->getInput('u'));
|
||||
|
||||
foreach($html->find('section.card') as $element) {
|
||||
|
@ -409,8 +409,6 @@ class VkBridge extends BridgeAbstract
|
||||
|
||||
private function getContents()
|
||||
{
|
||||
ini_set('user-agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0');
|
||||
|
||||
$header = array('Accept-language: en', 'Cookie: remixlang=3');
|
||||
|
||||
return getContents($this->getURI(), $header);
|
||||
|
@ -41,9 +41,6 @@ class WebfailBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
|
||||
ini_set('user_agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0');
|
||||
|
||||
$html = getSimpleHTMLDOM($this->getURI() . $this->getInput('type'));
|
||||
|
||||
$type = array_search($this->getInput('type'),
|
||||
|
@ -47,7 +47,8 @@ class ZoneTelechargementBridge extends BridgeAbstract {
|
||||
$header = array();
|
||||
// Parse the URL to extract the hostname
|
||||
$parse = parse_url($url);
|
||||
$opts = array(CURLOPT_USERAGENT => 'curl/7.64.0',
|
||||
$opts = array(
|
||||
CURLOPT_USERAGENT => Configuration::getConfig('http', 'useragent'),
|
||||
CURLOPT_RESOLVE => $this->getResolve($parse['host'])
|
||||
);
|
||||
|
||||
|
@ -12,6 +12,9 @@
|
||||
; timezone = "UTC" (default)
|
||||
timezone = "UTC"
|
||||
|
||||
[http]
|
||||
useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
|
||||
|
||||
[cache]
|
||||
|
||||
; Defines the cache type used by RSS-Bridge
|
||||
|
10
index.php
10
index.php
@ -17,16 +17,6 @@ if (isset($argv)) {
|
||||
$params = $_GET;
|
||||
}
|
||||
|
||||
define('USER_AGENT',
|
||||
'Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0(rss-bridge/'
|
||||
. Configuration::$VERSION
|
||||
. ';+'
|
||||
. REPOSITORY
|
||||
. ')'
|
||||
);
|
||||
|
||||
ini_set('user_agent', USER_AGENT);
|
||||
|
||||
try {
|
||||
|
||||
$actionFac = new \ActionFactory();
|
||||
|
@ -168,7 +168,7 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
|
||||
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, ini_get('user_agent'));
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Configuration::getConfig('http', 'useragent'));
|
||||
curl_setopt($ch, CURLOPT_ENCODING, '');
|
||||
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
<description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/</description>
|
||||
<exclude-pattern>./static</exclude-pattern>
|
||||
<exclude-pattern>./vendor</exclude-pattern>
|
||||
<exclude-pattern>./config.default.ini.php</exclude-pattern>
|
||||
<!-- Duplicate class names are not allowed -->
|
||||
<rule ref="Generic.Classes.DuplicateClassName"/>
|
||||
<!-- Statements must not be empty -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user