@@ -197,6 +197,7 @@ Namespace API.Twitter
197
197
# Region "Video options"
198
198
Private Function CheckVideoNode( ByVal w As EContainer, ByVal PostID As String , ByVal PostDate As String ) As Boolean
199
199
Try
200
+ If CheckForGif(w, PostID, PostDate) Then Return True
200
201
Dim URL$ = GetVideoNodeURL(w)
201
202
If Not URL.IsEmptyString Then
202
203
Dim f$ = UrlFile(URL)
@@ -212,6 +213,41 @@ Namespace API.Twitter
212
213
Return False
213
214
End Try
214
215
End Function
216
+ Private Function CheckForGif( ByVal w As EContainer, ByVal PostID As String , ByVal PostDate As String ) As Boolean
217
+ Try
218
+ Dim gifUrl As Predicate( Of EContainer) = Function (e) Not e.Value( "content_type" ).IsEmptyString AndAlso
219
+ e.Value( "content_type" ).Contains( "mp4" ) AndAlso
220
+ Not e.Value( "url" ).IsEmptyString
221
+ Dim url$, ff$
222
+ Dim f As SFile
223
+ Dim m As UserMedia
224
+ With w({ "extended_entities" , "media" }).XmlIfNothing
225
+ If .Count > 0 Then
226
+ For Each n As EContainer In .Self
227
+ If n.Value( "type" ) = "animated_gif" Then
228
+ With n({ "video_info" , "variants" }).XmlIfNothing.ItemF({gifUrl}).XmlIfNothing
229
+ url = .Value( "url" )
230
+ ff = UrlFile(url)
231
+ If Not ff.IsEmptyString Then
232
+ If Not _DataNames.Contains(ff) Then
233
+ m = MediaFromData(url, PostID, PostDate)
234
+ f = m.File
235
+ If Not f.IsEmptyString Then f.Name = $"GIF_{f.Name}" : m.File = f
236
+ _TempMediaList.ListAddValue(m, LNC)
237
+ End If
238
+ Return True
239
+ End If
240
+ End With
241
+ End If
242
+ Next
243
+ End If
244
+ End With
245
+ Return False
246
+ Catch ex As Exception
247
+ LogError(ex, "[API.Twitter.UserData.CheckForGif]" )
248
+ Return False
249
+ End Try
250
+ End Function
215
251
Private Shared Function GetVideoNodeURL( ByVal w As EContainer) As String
216
252
Dim v As EContainer = w.GetNode(VideoNode)
217
253
If Not v Is Nothing AndAlso v.Count > 0 Then
0 commit comments