Skip to content

Commit

Permalink
fix dictionaryapi trans
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsty1e committed May 14, 2020
1 parent a2a2d27 commit b1e0d61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function (ResponseInterface $response) use ($print) {
);

// dictionaryapi
$promises[] = $request->getAsync(str_replace('${word}', $word, $source->dictionaryapi), ['timeout' => 6])
$promises[] = $request->getAsync(str_replace('${word}', $word, $source->dictionaryapi), ['timeout' => 12])
->then(
function (ResponseInterface $response) use ($print) {
if ($response->getStatusCode() === 200) {
Expand Down
5 changes: 4 additions & 1 deletion lib/print.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@

$export->dictionaryapi = function ($data, $options = null) use ($output) {
$output->writeln('');
if (empty($data->entry) || !is_array($data->entry)) return null;
if (empty($data->entry)) return null;
if (!is_array($data->entry)) {
$data->entry = [$data->entry];
}
$word = $data->entry[0]->hw;
$output->writeln(' ' . $word . '<gray> ~ dictionaryapi.com</gray>');
$output->writeln('');
Expand Down

0 comments on commit b1e0d61

Please sign in to comment.