1
1
package mServer .crawler .sender .funk .json ;
2
2
3
3
import com .google .gson .*;
4
+ import de .mediathekview .mlib .tool .Log ;
4
5
import mServer .crawler .sender .base .FilmUrlInfoDto ;
5
6
import mServer .crawler .sender .base .JsonUtils ;
7
+ import org .apache .logging .log4j .LogManager ;
8
+ import org .apache .logging .log4j .Logger ;
6
9
7
10
import java .lang .reflect .Type ;
8
11
import java .util .Arrays ;
13
16
14
17
public class NexxCloudVideoDetailsDeserializer implements JsonDeserializer <Set <FilmUrlInfoDto >> {
15
18
// https://[result.streamdata.cdnShieldProgHTTP]/[result.streamdata.azureLocator]/[result.general.ID]_src_[result.streamdata.azureFileDistribution].mp4
16
- private static final String VIDEO_FILE_URL_PATTERN = "https://%s%s/%s_src_%dx%d_%d .mp4" ;
19
+ private static final String VIDEO_FILE_URL_PATTERN = "https://%s%s/%s_src_%dx%d_%s .mp4" ;
17
20
// globalstatic+details["qAccount"]+"/files/"+details["qPrefix"]+"/"+details["qLocator"]+"/"+ss+".mp4"
18
21
private static final String VIDEO_FILE_URL_PATTERN_3Q = "https://%s%s/files/%s/%s/%s.mp4" ;
19
22
private static final String TAG_RESULT = "result" ;
@@ -33,6 +36,9 @@ public class NexxCloudVideoDetailsDeserializer implements JsonDeserializer<Set<F
33
36
private static final String STREAMDATA_CDN_TYPE = "cdnType" ;
34
37
private static final String STREAMDATA_SSH_HOST = "cdnShieldHTTPS" ;
35
38
39
+ private static final Logger LOGGER =
40
+ LogManager .getLogger (NexxCloudVideoDetailsDeserializer .class );
41
+
36
42
@ Override
37
43
public Set <FilmUrlInfoDto > deserialize (
38
44
final JsonElement jsonElement , final Type typeOfT , final JsonDeserializationContext context )
@@ -163,15 +169,20 @@ private Optional<NexxResolutionDTO> toResolution(final String resolutionText) {
163
169
final String [] resolutionTextSplitted = resolutionText .split (SPLITERATOR_COLON );
164
170
Optional <String > fileId = Optional .empty ();
165
171
if (resolutionTextSplitted .length >= 2 ) {
166
- final int size = Integer .parseInt (resolutionTextSplitted [0 ]);
167
- final String [] reolutions = resolutionTextSplitted [1 ].split (SPLITERATOR_X );
168
- if (reolutions .length == 2 ) {
169
- final int width = Integer .parseInt (clearNumber (reolutions [0 ]));
170
- final int height = Integer .parseInt (clearNumber (reolutions [1 ]));
171
- if (resolutionTextSplitted .length > 2 ) {
172
- fileId = Optional .of (resolutionTextSplitted [2 ]);
172
+ try {
173
+ final String size = resolutionTextSplitted [0 ].replaceAll ("^0+(?!$)" , "" );
174
+ final String [] reolutions = resolutionTextSplitted [1 ].split (SPLITERATOR_X );
175
+ if (reolutions .length == 2 ) {
176
+ final int width = Integer .parseInt (clearNumber (reolutions [0 ]));
177
+ final int height = Integer .parseInt (clearNumber (reolutions [1 ]));
178
+ if (resolutionTextSplitted .length > 2 ) {
179
+ fileId = Optional .of (resolutionTextSplitted [2 ]);
180
+ }
181
+ return Optional .of (new NexxResolutionDTO (width , height , size , fileId ));
173
182
}
174
- return Optional .of (new NexxResolutionDTO (width , height , size , fileId ));
183
+ } catch (NumberFormatException e ) {
184
+ LOGGER .error (e );
185
+ Log .errorLog (62345326 , e );
175
186
}
176
187
}
177
188
return Optional .empty ();
0 commit comments