mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 06:08:27 +01:00
fix: small notice errors (#3677)
* fix notice * fix notice * tweak * tweaks
This commit is contained in:
parent
e6aef73a02
commit
0bf38e5c56
@ -181,7 +181,12 @@ class CodebergBridge extends BridgeAbstract
|
||||
$item['title'] = $message->find('span.message-wrapper', 0)->plaintext;
|
||||
$item['uri'] = $tr->find('td.sha', 0)->find('a', 0)->href;
|
||||
$item['author'] = $tr->find('td.author', 0)->plaintext;
|
||||
$item['timestamp'] = $tr->find('td', 3)->find('span', 0)->title;
|
||||
|
||||
$var = $tr->find('td', 3);
|
||||
$var1 = $var->find('span', 0);
|
||||
if ($var1) {
|
||||
$item['timestamp'] = $var1->title;
|
||||
}
|
||||
|
||||
if ($message->find('pre.commit-body', 0)) {
|
||||
$message->find('pre.commit-body', 0)->style = '';
|
||||
|
@ -55,8 +55,11 @@ class TelegramBridge extends BridgeAbstract
|
||||
$item['title'] = $this->itemTitle;
|
||||
$item['timestamp'] = $messageDiv->find('span.tgme_widget_message_meta', 0)->find('time', 0)->datetime;
|
||||
$item['enclosures'] = $this->enclosures;
|
||||
$author = trim($messageDiv->find('a.tgme_widget_message_owner_name', 0)->plaintext);
|
||||
$item['author'] = html_entity_decode($author, ENT_QUOTES);
|
||||
|
||||
$messageOwner = $messageDiv->find('a.tgme_widget_message_owner_name', 0);
|
||||
if ($messageOwner) {
|
||||
$item['author'] = html_entity_decode(trim($messageOwner->plaintext), ENT_QUOTES);
|
||||
}
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ class ThePirateBayBridge extends BridgeAbstract
|
||||
'207' => 'HD Movies',
|
||||
'208' => 'HD TV-Shows',
|
||||
'209' => '3D',
|
||||
'211' => 'UHD/4k Movies',
|
||||
'212' => 'UHD/4k TV-Shows',
|
||||
'299' => 'Other',
|
||||
'301' => 'Windows',
|
||||
|
@ -90,7 +90,8 @@ EOD;
|
||||
'channel' => $channel,
|
||||
'types' => self::BROADCAST_TYPES[$type]
|
||||
];
|
||||
$data = $this->apiRequest($query, $variables);
|
||||
$response = $this->apiRequest($query, $variables);
|
||||
$data = $response->data;
|
||||
if ($data->user === null) {
|
||||
throw new \Exception(sprintf('Unable to find channel `%s`', $channel));
|
||||
}
|
||||
@ -205,37 +206,29 @@ EOD;
|
||||
);
|
||||
}
|
||||
|
||||
// GraphQL: https://graphql.org/
|
||||
// Tool for developing/testing queries: https://github.com/skevy/graphiql-app
|
||||
/**
|
||||
* GraphQL: https://graphql.org/
|
||||
* Tool for developing/testing queries: https://github.com/skevy/graphiql-app
|
||||
*
|
||||
* Official instructions for obtaining your own client ID can be found here:
|
||||
* https://dev.twitch.tv/docs/v5/#getting-a-client-id
|
||||
*/
|
||||
private function apiRequest($query, $variables)
|
||||
{
|
||||
$request = [
|
||||
'query' => $query,
|
||||
'variables' => $variables
|
||||
'query' => $query,
|
||||
'variables' => $variables,
|
||||
];
|
||||
/**
|
||||
* Official instructions for obtaining your own client ID can be found here:
|
||||
* https://dev.twitch.tv/docs/v5/#getting-a-client-id
|
||||
*/
|
||||
$header = [
|
||||
'Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko'
|
||||
$headers = [
|
||||
'Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko',
|
||||
];
|
||||
$opts = [
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => json_encode($request)
|
||||
CURLOPT_POSTFIELDS => json_encode($request),
|
||||
];
|
||||
|
||||
Logger::debug("Sending GraphQL query:\n" . $query);
|
||||
Logger::debug("Sending GraphQL variables:\n" . json_encode($variables, JSON_PRETTY_PRINT));
|
||||
$response = json_decode(getContents('https://gql.twitch.tv/gql', $header, $opts));
|
||||
Logger::debug("Got GraphQL response:\n" . json_encode($response, JSON_PRETTY_PRINT));
|
||||
|
||||
if (isset($response->errors)) {
|
||||
$messages = array_column($response->errors, 'message');
|
||||
throw new \Exception(sprintf('twitch api: `%s`', implode("\n", $messages)));
|
||||
}
|
||||
|
||||
return $response->data;
|
||||
$json = getContents('https://gql.twitch.tv/gql', $headers, $opts);
|
||||
$result = Json::decode($json, false);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
Loading…
x
Reference in New Issue
Block a user