@@ -15,6 +15,16 @@ internal static class YahooSession
15
15
private static FlurlCookie _cookie ;
16
16
private static SemaphoreSlim _semaphore = new SemaphoreSlim ( 1 , 1 ) ;
17
17
18
+ /// <summary>
19
+ /// The user agent key for HTTP Header
20
+ /// </summary>
21
+ public const string UserAgentKey = "User-Agent" ;
22
+
23
+ /// <summary>
24
+ /// The user agent value for HTTP Header
25
+ /// </summary>
26
+ public const string UserAgentValue = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0" ;
27
+
18
28
/// <summary>
19
29
/// Gets or sets the auth crumb.
20
30
/// </summary>
@@ -58,14 +68,11 @@ public static async Task InitAsync(CancellationToken token = default)
58
68
await _semaphore . WaitAsync ( token ) . ConfigureAwait ( false ) ;
59
69
try
60
70
{
61
- const string userAgentKey = "User-Agent" ;
62
- const string userAgentValue = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" ;
63
-
64
71
var response = await "https://fc.yahoo.com"
65
72
. AllowHttpStatus ( "404" )
66
73
. AllowHttpStatus ( "500" )
67
74
. AllowHttpStatus ( "502" )
68
- . WithHeader ( userAgentKey , userAgentValue )
75
+ . WithHeader ( UserAgentKey , UserAgentValue )
69
76
. GetAsync ( )
70
77
. ConfigureAwait ( false ) ;
71
78
@@ -81,7 +88,7 @@ public static async Task InitAsync(CancellationToken token = default)
81
88
82
89
_crumb = await "https://query1.finance.yahoo.com/v1/test/getcrumb"
83
90
. WithCookie ( _cookie . Name , _cookie . Value )
84
- . WithHeader ( userAgentKey , userAgentValue )
91
+ . WithHeader ( UserAgentKey , UserAgentValue )
85
92
. GetAsync ( token )
86
93
. ReceiveString ( ) ;
87
94
0 commit comments