fix upload date: there was a one hour delay

on peertube.co.uk: https://i.imgur.com/8Pai1rb.png
on newpipe, before this commit: https://i.imgur.com/NIRbs4Z.png
on newpipe, with this commit: https://i.ibb.co/mhKKtRD/Screenshot-20200123-185422-New-Pipe-Debug.png
This commit is contained in:
bopol 2020-01-23 19:02:40 +01:00
parent 20da4750f8
commit a691d6d0fc

View File

@ -4,6 +4,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.jsoup.helper.StringUtil; import org.jsoup.helper.StringUtil;
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
@ -27,6 +28,7 @@ public class PeertubeParsingHelper {
Date date; Date date;
try { try {
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'").parse(textualUploadDate); date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'").parse(textualUploadDate);
date = new Date(date.getTime() + TimeUnit.HOURS.toMillis(1));
} catch (ParseException e) { } catch (ParseException e) {
throw new ParsingException("Could not parse date: \"" + textualUploadDate + "\"", e); throw new ParsingException("Could not parse date: \"" + textualUploadDate + "\"", e);
} }