mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-24 02:16:08 +03:00
[YorushikaBridge] Fix getting date (#4077)
* Remove unnecessary variable * Fix getting date
This commit is contained in:
parent
89013faf7d
commit
b4d397ff70
1 changed files with 2 additions and 9 deletions
|
@ -41,7 +41,6 @@ class YorushikaBridge extends BridgeAbstract
|
|||
|
||||
public function collectData()
|
||||
{
|
||||
$url = 'https://yorushika.com/news/5/';
|
||||
switch ($this->getInput('lang')) {
|
||||
case 'jp':
|
||||
$url = 'https://yorushika.com/news/5/';
|
||||
|
@ -99,14 +98,8 @@ class YorushikaBridge extends BridgeAbstract
|
|||
|
||||
// Get article date
|
||||
$date = $art->find('.date', 0)->plaintext;
|
||||
if (preg_match('/(\d)年(\d)月(\d)/', $date, $matches)) {
|
||||
// Some dates will contain Chinese characters, remove those from the string
|
||||
$formattedDate = sprintf('%d.%02d.%02d', $matches[1], $matches[2], $matches[3]);
|
||||
} else {
|
||||
// Assume the date is already in 'Y.m.d' format
|
||||
preg_match('/\d+\.\d+\.\d+/', $date, $matches);
|
||||
$formattedDate = $matches[0];
|
||||
}
|
||||
preg_match('/(\d+)[\.年](\d+)[\.月](\d+)/u', $date, $matches);
|
||||
$formattedDate = sprintf('%d.%02d.%02d', $matches[1], $matches[2], $matches[3]);
|
||||
$date = date_create_from_format('Y.m.d', $formattedDate);
|
||||
$date = date_format($date, 'd.m.Y');
|
||||
|
||||
|
|
Loading…
Reference in a new issue