@@ -48,9 +48,23 @@ public function getData(Feed $feed): array
48
48
49
49
$ token = $ secrets ['token ' ];
50
50
51
- $ data = $ this ->getMentions ($ token , $ pageSize , $ configuration ['feeds ' ]);
51
+ $ data = $ this ->getMentions ($ token , 1 , $ pageSize , $ configuration ['feeds ' ]);
52
52
53
- return array_map (fn (array $ item ) => $ this ->getFeedItemObject ($ item ), $ data );
53
+ $ feedItems = array_map (fn (array $ item ) => $ this ->getFeedItemObject ($ item ), $ data );
54
+
55
+ $ result = [];
56
+
57
+ // Check that image is accessible, otherwise leave out the feed element.
58
+ foreach ($ feedItems as $ feedItem ) {
59
+ $ response = $ this ->client ->request (Request::METHOD_HEAD , $ feedItem ['mediaUrl ' ]);
60
+ $ statusCode = $ response ->getStatusCode ();
61
+
62
+ if (200 == $ statusCode ) {
63
+ $ result [] = $ feedItem ;
64
+ }
65
+ }
66
+
67
+ return $ result ;
54
68
} catch (\Throwable $ throwable ) {
55
69
$ this ->logger ->error ('{code}: {message} ' , [
56
70
'code ' => $ throwable ->getCode (),
@@ -115,11 +129,11 @@ public function getConfigOptions(Request $request, FeedSource $feedSource, strin
115
129
return null ;
116
130
}
117
131
118
- public function getMentions (string $ token , int $ pageSize = 10 , array $ searchProfileIds = []): array
132
+ public function getMentions (string $ token , int $ page = 1 , int $ pageSize = 10 , array $ searchProfileIds = []): array
119
133
{
120
134
$ body = [
135
+ 'page ' => $ page ,
121
136
'pageSize ' => $ pageSize ,
122
- 'page ' => 1 ,
123
137
'searchProfileIds ' => $ searchProfileIds ,
124
138
];
125
139
0 commit comments