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()
21
21
}
22
22
23
23
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
+ }
26
29
}
27
30
}
28
31
}
@@ -56,6 +59,10 @@ public function getAuthorName()
56
59
*/
57
60
public function getPublishedTime ()
58
61
{
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
+ }
60
67
}
61
68
}
Original file line number Diff line number Diff line change @@ -138,10 +138,29 @@ public function getHeight()
138
138
*/
139
139
public function getPublishedTime ()
140
140
{
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
+ }
145
164
}
146
165
147
166
/**
You can’t perform that action at this time.
0 commit comments