@@ -44,9 +44,10 @@ func main() {
44
44
day := flag .Int ("day" , 0 , "day (0-7)" )
45
45
scale := flag .Float64 ("scale" , 1.5 , "scale" )
46
46
padding := flag .Int ("padding" , 20 , "padding" )
47
+ remote := flag .String ("remote" , "" , "remote" )
47
48
out := flag .String ("out" , "" , "out file" )
48
49
flag .Parse ()
49
- if err := run (context .Background (), * verbose , * timeout , * query , * lang , * unit , * typ , * day , * scale , * padding , * out ); err != nil {
50
+ if err := run (context .Background (), * verbose , * timeout , * query , * lang , * unit , * typ , * day , * scale , * padding , * remote , * out ); err != nil {
50
51
fmt .Fprintf (os .Stderr , "error: %v\n " , err )
51
52
if strings .HasPrefix (err .Error (), "invalid lang " ) {
52
53
fmt .Fprint (os .Stderr , "\n valid languages:\n " )
@@ -58,7 +59,7 @@ func main() {
58
59
}
59
60
}
60
61
61
- func run (ctx context.Context , verbose bool , timeout time.Duration , query , lang , unit , typ string , day int , scale float64 , padding int , out string ) error {
62
+ func run (ctx context.Context , verbose bool , timeout time.Duration , query , lang , unit , typ string , day int , scale float64 , padding int , remote , out string ) error {
62
63
// check
63
64
lang = strings .ToLower (lang )
64
65
if _ , ok := langs [lang ]; ! ok && lang != "" {
@@ -84,7 +85,7 @@ func run(ctx context.Context, verbose bool, timeout time.Duration, query, lang,
84
85
return fmt .Errorf ("invalid padding %d" , padding )
85
86
}
86
87
87
- query = "weather " + query
88
+ query = "weather forecast " + query
88
89
89
90
// build search params
90
91
v := make (url.Values )
@@ -93,6 +94,11 @@ func run(ctx context.Context, verbose bool, timeout time.Duration, query, lang,
93
94
v .Set ("hl" , lang )
94
95
}
95
96
97
+ // use remote allocator context if specified
98
+ if remote != "" {
99
+ ctx , _ = chromedp .NewRemoteAllocator (ctx , remote )
100
+ }
101
+
96
102
// create chrome instance
97
103
var opts []chromedp.ContextOption
98
104
if verbose {
0 commit comments