Added better link processing
This commit is contained in:
parent
309d7c0cd3
commit
f8f94b4afc
@ -12,15 +12,14 @@ namespace TeleTok
|
|||||||
string url = videourl;
|
string url = videourl;
|
||||||
string proxyUrl;
|
string proxyUrl;
|
||||||
|
|
||||||
DateTime now =DateTime.Now;
|
TeleTok.LogMessage("Video for " + videourl + " processing..");
|
||||||
|
|
||||||
if(url.Contains("vm.tiktok.com"))
|
if(url.Contains("vm.tiktok.com"))
|
||||||
{
|
{
|
||||||
url = UnshortenUrl(url);
|
url = UnshortenUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyUrl = TeleTok.ptInstance + "/download?url=" + url;
|
proxyUrl = CreateDownloadLink(url);
|
||||||
Console.WriteLine("[" + now.ToString() + "] " + "Video for " + url + " has been sent..");
|
|
||||||
|
|
||||||
return proxyUrl;
|
return proxyUrl;
|
||||||
}
|
}
|
||||||
@ -35,5 +34,25 @@ namespace TeleTok
|
|||||||
|
|
||||||
return realUrl;
|
return realUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Breaks apart the URL and extracts the User and Video ID to be processed into a working download link
|
||||||
|
static string CreateDownloadLink(string videourl)
|
||||||
|
{
|
||||||
|
Uri segmentedUri = new Uri(videourl);
|
||||||
|
segmentedUri = new Uri(segmentedUri.AbsoluteUri.Replace(segmentedUri.Query, string.Empty));
|
||||||
|
|
||||||
|
string videoUser = segmentedUri.Segments[1];
|
||||||
|
videoUser = videoUser.Replace(@"/", "");
|
||||||
|
string videoID = segmentedUri.Segments[3];
|
||||||
|
|
||||||
|
string fixedUrl = "https://www.tiktok.com/" + videoUser + "/video/" + videoID + @"&id=" + videoID + @"&user=" + videoUser.Remove(0);
|
||||||
|
|
||||||
|
string proxyLink = TeleTok.ptInstance + "/download?url=" + fixedUrl;
|
||||||
|
|
||||||
|
TeleTok.LogMessage("Input User ID is: " + videoUser);
|
||||||
|
TeleTok.LogMessage("Input video ID is: " + videoID);
|
||||||
|
|
||||||
|
return proxyLink;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user