File tree Expand file tree Collapse file tree 2 files changed +33
-7
lines changed
Expand file tree Collapse file tree 2 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,11 @@ public function run()
2121 }
2222
2323 foreach (Utils::getMetas ($ html ) as $ meta ) {
24- if (stripos ($ meta [0 ], 'dc. ' ) === 0 ) {
25- $ this ->bag ->set (substr ($ meta [0 ], 3 ), $ meta [1 ]);
24+ foreach (['dc. ' , 'dc: ' , 'dcterms: ' ] as $ prefix ) {
25+ if (stripos ($ meta [0 ], $ prefix ) === 0 ) {
26+ $ key = substr ($ meta [0 ], strlen ($ prefix ));
27+ $ this ->bag ->set ($ key , $ meta [1 ]);
28+ }
2629 }
2730 }
2831 }
@@ -56,6 +59,10 @@ public function getAuthorName()
5659 */
5760 public function getPublishedTime ()
5861 {
59- return $ this ->bag ->get ('date ' );
62+ foreach (['date ' , 'date.created ' , 'date.issued ' ] as $ key ) {
63+ if ($ found = $ this ->bag ->get ($ key )) {
64+ return $ found ;
65+ }
66+ }
6067 }
6168}
Original file line number Diff line number Diff line change @@ -138,10 +138,29 @@ public function getHeight()
138138 */
139139 public function getPublishedTime ()
140140 {
141- return $ this ->bag ->get ('pub_date ' )
142- ?: $ this ->bag ->get ('date ' )
143- ?: $ this ->bag ->get ('pagerender ' )
144- ?: $ this ->bag ->get ('datepublished ' );
141+ $ keys = [
142+ 'article:published_time ' ,
143+ 'created ' ,
144+ 'date ' ,
145+ 'datepublished ' ,
146+ 'datePublished ' ,
147+ 'newsrepublic:publish_date ' ,
148+ 'pagerender ' ,
149+ 'pub_date ' ,
150+ 'publication-date ' ,
151+ 'publish-date ' ,
152+ 'rc.datecreation ' ,
153+ 'timestamp ' ,
154+ 'article:modified_time ' ,
155+ 'eomportal-lastupdate ' ,
156+ 'shareaholic:article_published_time ' ,
157+ ];
158+
159+ foreach ($ keys as $ key ) {
160+ if ($ found = $ this ->bag ->get ($ key )) {
161+ return $ found ;
162+ }
163+ }
145164 }
146165
147166 /**
You can’t perform that action at this time.
0 commit comments