Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@NohamR
Copy link
Contributor

@NohamR NohamR commented Apr 12, 2025

Update to new website structure.

@github-actions
Copy link

github-actions bot commented Apr 12, 2025

Pull request artifacts

Bridge Context Status
AppleAppStore 1 untitled (current) Bridge returned error 401! (20199)
Type: HttpException
Message: https://amp-api.apps.apple.com/v1/catalog/USs/310633997?platform=iphone&extend=versionHistory resulted in 401 Unauthorized
AppleAppStore 1 untitled (pr) ✔️

last change: Monday 2025-04-21 18:16:57

return 'https://apps.apple.com/' . $country . '/app/id' . $id;
$id = $this->getInput('id');
$country = $this->getInput('country');
return "https://apps.apple.com/{$country}/app/id{$id}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls choose an alternative way to interpolate string, e.g. sprintf

$json = json_decode($script->innertext, true);
return $json['data'];
if ($this->getInput('debug')) {
error_log("[AppleAppStoreBridge] $message");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls dont use error_log.

use:

$this->logger->info('hello world')

$this->logger->warning('hello world')

$this->logger->error('hello world')


$html = getSimpleHTMLDOM($url);

if (!$html) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will never happen because return value is always \simple_html_dom, or it throws exception

throw new \Exception("JWT token not found in page content");
}

try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put as little code as possible in the try clause

try {
$decoded_content = urldecode($meta->content);
$this->debugLog("Found meta tag content");
$decoded_json = json_decode($decoded_content, true);
Copy link
Contributor

@dvikan dvikan Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See Json::decode



$content = getContents($url, $headers);
if (!$content) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getContents returns string|Response, most commonly a string

default:
$os = self::PLATFORM_MAPPING[$platform];
return $data['attributes']['platformAttributes'][$os]['versionHistory'];
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code does not need to be wrapped in a try catch


if (isset($data['attributes']['platformAttributes'][$platform_key]['versionHistory'])) {
return $data['attributes']['platformAttributes'][$platform_key]['versionHistory'];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should work:

$version = $data['attributes']['platformAttributes'][$platform_key]['versionHistory'] ?? null

$this->debugLog("Getting data for " . $this->getInput('p') . " app");
$data = $this->getAppData();

list($name, $author) = $this->extractAppDetails($data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls dont use list(). I think php has proper lang syntax for this unpacking.

Something like:

[$name, $auth] = $this->extractAppDetails($data);

@dvikan
Copy link
Contributor

dvikan commented Apr 12, 2025

lint

@NohamR
Copy link
Contributor Author

NohamR commented Apr 12, 2025

Sorry, I originally wrote the script in Python and don't know much about PHP.

@dvikan dvikan merged commit 9fb4a5d into RSS-Bridge:master May 9, 2025
3 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants