Hi,dan.crouthamel wrote:When I download a podcast, so for a youtube user, the create date in the table shows the time at which I downloaded the podcast. How can I update it to show the date which the video was uploaded?
Thanks.
Put this piece of code into "The script read additional properties RSS" settings section of the podcast:
Code: Select all
var
sYoutube, sVideoID: string;
xYoutube: TXMLDocument;
function GetYoutubeDate(const sValue: string): variant;
begin
if trim(sValue) <> '' then Result := Copy(sValue, 9, 2) + '.' + Copy(sValue, 6, 2) + '.' + Copy(sValue, 1, 4) + ' ' + Copy(sValue, 12, 5)
else Result := Now;
end;
begin
if WmsRegExMatch('watch\?v=(.*)&', mpFilePath, sVideoID) and (sVideoID <> '') then begin
sYoutube := WmsDownloadURL('http://gdata.youtube.com/feeds/api/videos/' + sVideoID + '?fields=published');
xYoutube := TXMLDocument.Create;
try
xYoutube.LoadFromString(sYoutube);
PodcastItem.Properties(mpiCreateDate) := GetYoutubeDate(xYoutube.root.childvalues('published'));
finally
xYoutube.free
end
end
end.