mirror of
https://github.com/hnhx/librex.git
synced 2025-01-26 10:43:05 -03:00
refactor: solve error request due to invalid request protocol
This commit is contained in:
parent
a25893b53d
commit
0ef03edcb1
3 changed files with 6 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
|
/.vscode
|
||||||
/config.php
|
/config.php
|
||||||
/opensearch.xml
|
/opensearch.xml
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
"wikipedia_language" => "en",
|
"wikipedia_language" => "en",
|
||||||
|
|
||||||
// You can use any Invidious instance here
|
// You can use any Invidious instance here
|
||||||
"invidious_instance_for_video_results" => "https://invidious.namazso.eu",
|
"invidious_instance_for_video_results" => "https://invidious.snopyta.org",
|
||||||
|
|
||||||
"disable_bittorent_search" => false,
|
"disable_bittorent_search" => false,
|
||||||
"bittorent_trackers" => "&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
|
"bittorent_trackers" => "&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://open.stealth.si:80/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce",
|
||||||
|
|
||||||
"disable_hidden_service_search" => false,
|
"disable_hidden_service_search" => false,
|
||||||
|
|
||||||
|
@ -130,9 +130,9 @@
|
||||||
// CURLOPT_PROXY => "ip:port",
|
// CURLOPT_PROXY => "ip:port",
|
||||||
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => "",
|
CURLOPT_ENCODING => "UTF-8",
|
||||||
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
|
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
|
||||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_WHATEVER,
|
||||||
CURLOPT_CUSTOMREQUEST => "GET",
|
CURLOPT_CUSTOMREQUEST => "GET",
|
||||||
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
||||||
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
||||||
|
|
|
@ -2,13 +2,11 @@
|
||||||
function get_video_results($query)
|
function get_video_results($query)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$instance_url = $config->invidious_instance_for_video_results;
|
$instance_url = $config->invidious_instance_for_video_results;
|
||||||
|
|
||||||
$url = "$instance_url/api/v1/search?q=$query";
|
$url = "$instance_url/api/v1/search?q=$query";
|
||||||
$response = request($url);
|
$response = request($url);
|
||||||
$json_response = json_decode($response, true);
|
$json_response = json_decode($response, true);
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
foreach ($json_response as $response)
|
foreach ($json_response as $response)
|
||||||
|
|
Loading…
Add table
Reference in a new issue