mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-24 10:26:11 +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()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$url = 'https://yorushika.com/news/5/';
|
|
||||||
switch ($this->getInput('lang')) {
|
switch ($this->getInput('lang')) {
|
||||||
case 'jp':
|
case 'jp':
|
||||||
$url = 'https://yorushika.com/news/5/';
|
$url = 'https://yorushika.com/news/5/';
|
||||||
|
@ -99,14 +98,8 @@ class YorushikaBridge extends BridgeAbstract
|
||||||
|
|
||||||
// Get article date
|
// Get article date
|
||||||
$date = $art->find('.date', 0)->plaintext;
|
$date = $art->find('.date', 0)->plaintext;
|
||||||
if (preg_match('/(\d)年(\d)月(\d)/', $date, $matches)) {
|
preg_match('/(\d+)[\.年](\d+)[\.月](\d+)/u', $date, $matches);
|
||||||
// Some dates will contain Chinese characters, remove those from the string
|
$formattedDate = sprintf('%d.%02d.%02d', $matches[1], $matches[2], $matches[3]);
|
||||||
$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];
|
|
||||||
}
|
|
||||||
$date = date_create_from_format('Y.m.d', $formattedDate);
|
$date = date_create_from_format('Y.m.d', $formattedDate);
|
||||||
$date = date_format($date, 'd.m.Y');
|
$date = date_format($date, 'd.m.Y');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue