commit
f09ae32b00
@ -47,7 +47,7 @@ SQL
|
||||
$join->on('users.id', '=', 'ejaculations.user_id')
|
||||
->where('users.accept_analytics', true);
|
||||
})
|
||||
->where('ejaculated_date', '>=', now()->subDays(14))
|
||||
->where('ejaculated_date', '>=', now()->subDays(30))
|
||||
->groupBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
||||
->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
||||
->get()
|
||||
|
29
app/MetadataResolver/CienResolver.php
Normal file
29
app/MetadataResolver/CienResolver.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\MetadataResolver;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CienResolver extends MetadataResolver
|
||||
{
|
||||
public function resolve(string $url): Metadata
|
||||
{
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$res = $client->get($url);
|
||||
if ($res->getStatusCode() === 200) {
|
||||
$ogpResolver = new OGPResolver();
|
||||
$metadata = $ogpResolver->parse($res->getBody());
|
||||
|
||||
// 画像URLから有効期限の起点を拾う
|
||||
parse_str(parse_url($metadata->image, PHP_URL_QUERY), $params);
|
||||
if (empty($params['px-time'])) {
|
||||
throw new \RuntimeException('Parameter "px-time" not found. Image=' . $metadata->image . ' Source=' . $url);
|
||||
}
|
||||
$metadata->expires_at = Carbon::createFromTimestamp($params['px-time'])->addHour(1);
|
||||
|
||||
return $metadata;
|
||||
} else {
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ class MetadataResolver implements Resolver
|
||||
'~www\.patreon\.com/~' => PatreonResolver::class,
|
||||
'~www\.deviantart\.com/.*/art/.*~' => DeviantArtResolver::class,
|
||||
'~\.syosetu\.com/n\d+[a-z]{2,}~' => NarouResolver::class,
|
||||
'~ci-en\.jp/creator/\d+/article/\d+~' => CienResolver::class,
|
||||
];
|
||||
|
||||
public $mimeTypes = [
|
||||
|
Loading…
Reference in New Issue
Block a user