()
| 35 | } |
| 36 | |
| 37 | func NewBrowserSource() (*BrowserSource, error) { |
| 38 | browserPath, err := resolveBrowserOverride() |
| 39 | if err != nil { |
| 40 | return nil, err |
| 41 | } |
| 42 | |
| 43 | return &BrowserSource{ |
| 44 | BrowserPath: browserPath, |
| 45 | URL: defaultHomepageURL, |
| 46 | UserAgent: defaultBrowserUserAgent, |
| 47 | Timeout: 60 * time.Second, |
| 48 | PostLoadDelay: 1500 * time.Millisecond, |
| 49 | }, nil |
| 50 | } |
| 51 | |
| 52 | func (s *BrowserSource) Fetch(ctx context.Context) (document string, err error) { |
| 53 | if s == nil { |
no test coverage detected