试图在浏览器中设置引荐来源网址,但我在 puppeteersharp 中遇到错误?
trying to set referer in browser but i get error in puppeteersharp?
我想在 c# 中将 referrer 设置为 puppeteersharp,但出现错误
cannot convert from 'string' to
System.Collections.Generic.Dictionary<string, string>
这是我的代码:
Browser browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = false,
ExecutablePath = textBox6.Text,
//Args = { '--start-maximized' },
Args = new string[]
{string.Format("--proxy-server={0}",line)}
});
// Create a new page and go to Bing Maps
Page page = await browser.NewPageAsync();
//await page.GoToAsync("https://music.apple.com/login");
await page.SetUserAgentAsync("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36");
await page.SetExtraHttpHeadersAsync("facebook.com");
这是我得到的错误:
enter image description here
SetExtraHttpHeadersAsync
期望带有 headers 的字典附加:
await Page.SetExtraHttpHeadersAsync(new Dictionary<string, string>
{
["Referer"] = "Bar"
});
我想在 c# 中将 referrer 设置为 puppeteersharp,但出现错误
cannot convert from 'string' to
System.Collections.Generic.Dictionary<string, string>
这是我的代码:
Browser browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = false,
ExecutablePath = textBox6.Text,
//Args = { '--start-maximized' },
Args = new string[]
{string.Format("--proxy-server={0}",line)}
});
// Create a new page and go to Bing Maps
Page page = await browser.NewPageAsync();
//await page.GoToAsync("https://music.apple.com/login");
await page.SetUserAgentAsync("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36");
await page.SetExtraHttpHeadersAsync("facebook.com");
这是我得到的错误: enter image description here
SetExtraHttpHeadersAsync
期望带有 headers 的字典附加:
await Page.SetExtraHttpHeadersAsync(new Dictionary<string, string>
{
["Referer"] = "Bar"
});