经过数小时的搜索,我终于找到了这段代码,它允许我获得初始下载url。问题是我无法提取或找到实际的下载链接。
例如:
本网站
https://uploadfiles.io/5b2c6
提供该URL:
https://down.uploadfiles.io/get/5b2c6
所以这并不是最终的下载链接。
根据这个答案:
https://stackoverflow.com/a/13518164/5560277
我应该实施这三种方法
CreateBindCtx(0, out pbc);
RegisterCallback(pbc, url);
BindMonikerToStream(pmk, pbc);
但我真的找不到任何提示。
public class DownloadManagerImplementation : IDownloadManager
{
public int Download(IMoniker pmk, IBindCtx pbc, uint dwBindVerb, int grfBINDF,
IntPtr pBindInfo, string pszHeaders, string pszRedir, uint uiCP)
{
// Get the display name of the pointer to an IMoniker interface that specifies
// the object to be downloaded.
string name = string.Empty;
pmk.GetDisplayName(pbc, null, out name);
if (!string.IsNullOrEmpty(name))
{
Uri url = null;
bool result = Uri.TryCreate(name, UriKind.Absolute, out url);
if (result)
{
MessageBox.Show("Download URL is: " + url);
return 0;
}
}
return 1; //unspecified error occured.
}
}
如果有人能给出任何提示,或提供更多的代码样本,我将不胜感激。