Fix user agent

This commit is contained in:
edoardottt
2022-11-15 14:16:05 +01:00
parent d9d74ed498
commit ba714c026b
+4 -4
View File
@@ -312,10 +312,6 @@ func CreateColly(delayTime int, concurrency int, cache bool, timeout int,
c.IgnoreRobotsTxt = true
c.AllowURLRevisit = false
if userAgent != "" {
c.UserAgent = userAgent
}
err := c.Limit(
&colly.LimitRule{
Parallelism: concurrency,
@@ -345,6 +341,10 @@ func CreateColly(delayTime int, concurrency int, cache bool, timeout int,
c.UserAgent = GenerateRandomUserAgent()
}
if userAgent != "" {
c.UserAgent = userAgent
}
// Use a Proxy if needed
if proxy != "" {
err := c.SetProxy(proxy)