X-Git-Url: https://git.jacobcasper.com/?p=Marketplaylister.git;a=blobdiff_plain;f=mpfuncs.php;h=870acafb22a0685509587c103f729e671d46513b;hp=051619a1dedcb87339dbb391ef4258352d2b11a5;hb=29d84c29eac4bafa7aa1370578bce9e8e0a8f2bc;hpb=f90c532a8f7c631422dacf1113fec15d34c21f5e diff --git a/mpfuncs.php b/mpfuncs.php index 051619a..870acaf 100644 --- a/mpfuncs.php +++ b/mpfuncs.php @@ -1,6 +1,6 @@ hasAttribute('class') && $header->getAttribute('class') === 'river--hed') { - $dateStringParts = explode('/', explode(':', $header->nodeValue)[0]); - if ( strlen($dateStringParts[2]) === 2 ) { - $dateStringParts[2] = '20' . $dateStringParts[2]; - } - $episodeDate = DateTime::createFromFormat(DATE_FORM, implode("/", $dateStringParts)); + $episodeAnchorHref = $header->firstChild->getAttribute('href'); + $dateString = explode('/', $episodeAnchorHref)[3]; + $episodeDate = DateTime::createFromFormat(DATE_FORM, $dateString); if ($episodeDate < $lastDate) { break; } @@ -47,4 +45,4 @@ } } return $episodeDates; - } \ No newline at end of file + }