@@ -15,6 +15,16 @@ internal static class YahooSession
1515 private static FlurlCookie _cookie ;
1616 private static SemaphoreSlim _semaphore = new SemaphoreSlim ( 1 , 1 ) ;
1717
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+
1828 /// <summary>
1929 /// Gets or sets the auth crumb.
2030 /// </summary>
@@ -58,14 +68,11 @@ public static async Task InitAsync(CancellationToken token = default)
5868 await _semaphore . WaitAsync ( token ) . ConfigureAwait ( false ) ;
5969 try
6070 {
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-
6471 var response = await "https://fc.yahoo.com"
6572 . AllowHttpStatus ( "404" )
6673 . AllowHttpStatus ( "500" )
6774 . AllowHttpStatus ( "502" )
68- . WithHeader ( userAgentKey , userAgentValue )
75+ . WithHeader ( UserAgentKey , UserAgentValue )
6976 . GetAsync ( )
7077 . ConfigureAwait ( false ) ;
7178
@@ -81,7 +88,7 @@ public static async Task InitAsync(CancellationToken token = default)
8188
8289 _crumb = await "https://query1.finance.yahoo.com/v1/test/getcrumb"
8390 . WithCookie ( _cookie . Name , _cookie . Value )
84- . WithHeader ( userAgentKey , userAgentValue )
91+ . WithHeader ( UserAgentKey , UserAgentValue )
8592 . GetAsync ( token )
8693 . ReceiveString ( ) ;
8794
0 commit comments