From dadf17ebccaf7a88cd0bccba40455265eaa77266 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 28 Oct 2025 01:18:22 -0400 Subject: [PATCH] rename --- .../src/requests/index_page/get_index_page_and_scripts.rs | 4 ++-- .../requests/get_index_page_scripts_with_client.rs | 4 ++-- .../grok_client/src/requests/index_page/utils/mod.rs | 4 ++-- .../{parse_scripts.rs => parse_scripts_from_index_html.rs} | 6 +++--- ..._html.rs => parse_verification_token_from_index_html.rs} | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) rename crates/api_clients/grok_client/src/requests/index_page/utils/{parse_scripts.rs => parse_scripts_from_index_html.rs} (83%) rename crates/api_clients/grok_client/src/requests/index_page/utils/{parse_verification_token_from_html.rs => parse_verification_token_from_index_html.rs} (91%) diff --git a/crates/api_clients/grok_client/src/requests/index_page/get_index_page_and_scripts.rs b/crates/api_clients/grok_client/src/requests/index_page/get_index_page_and_scripts.rs index 7d2dc7a9dc..f5cf703531 100644 --- a/crates/api_clients/grok_client/src/requests/index_page/get_index_page_and_scripts.rs +++ b/crates/api_clients/grok_client/src/requests/index_page/get_index_page_and_scripts.rs @@ -3,7 +3,7 @@ use crate::error::grok_client_error::GrokClientError; use crate::error::grok_error::GrokError; use crate::requests::index_page::requests::get_index_page_scripts_with_client::{get_index_page_scripts_with_client, GetIndexPageScriptsArgs}; use crate::requests::index_page::requests::get_index_page_with_client::{get_index_page_with_client, GetIndexPageWithClientArgs}; -use crate::requests::index_page::utils::parse_scripts::parse_scripts; +use crate::requests::index_page::utils::parse_scripts_from_index_html::parse_scripts_from_index_html; use crate::utils::create_firefox_client::create_firefox_client; use log::info; use std::collections::HashMap; @@ -35,7 +35,7 @@ pub async fn get_index_page_and_scripts(args: GetIndexPageAndScriptsArgs<'_>) -> cookie: args.cookie, }).await?; - let scripts = parse_scripts(&index.body); + let scripts = parse_scripts_from_index_html(&index.body); info!("Fetching {} scripts...", scripts.len()); diff --git a/crates/api_clients/grok_client/src/requests/index_page/requests/get_index_page_scripts_with_client.rs b/crates/api_clients/grok_client/src/requests/index_page/requests/get_index_page_scripts_with_client.rs index e3fdc562fe..92fa1f2e90 100644 --- a/crates/api_clients/grok_client/src/requests/index_page/requests/get_index_page_scripts_with_client.rs +++ b/crates/api_clients/grok_client/src/requests/index_page/requests/get_index_page_scripts_with_client.rs @@ -41,7 +41,7 @@ pub async fn get_index_page_scripts_with_client(args: GetIndexPageScriptsArgs<'_ mod tests { use crate::requests::index_page::requests::get_index_page_scripts_with_client::{get_index_page_scripts_with_client, GetIndexPageScriptsArgs}; use crate::requests::index_page::requests::get_index_page_with_client::{get_index_page_with_client, GetIndexPageWithClientArgs}; - use crate::requests::index_page::utils::parse_scripts::parse_scripts; + use crate::requests::index_page::utils::parse_scripts_from_index_html::parse_scripts_from_index_html; use crate::test_utils::get_test_cookies::get_test_cookies; use crate::utils::create_firefox_client::create_firefox_client; use errors::AnyhowResult; @@ -59,7 +59,7 @@ mod tests { cookie: &cookie, }).await?; - let scripts = parse_scripts(&index.body); + let scripts = parse_scripts_from_index_html(&index.body); let scripts = get_index_page_scripts_with_client(GetIndexPageScriptsArgs { client: &client, diff --git a/crates/api_clients/grok_client/src/requests/index_page/utils/mod.rs b/crates/api_clients/grok_client/src/requests/index_page/utils/mod.rs index 0f613b8dd6..208edfd285 100644 --- a/crates/api_clients/grok_client/src/requests/index_page/utils/mod.rs +++ b/crates/api_clients/grok_client/src/requests/index_page/utils/mod.rs @@ -1,4 +1,4 @@ pub mod find_script_actions_and_xsid; -pub mod parse_scripts; -pub mod parse_verification_token_from_html; +pub mod parse_scripts_from_index_html; +pub mod parse_verification_token_from_index_html; pub mod verification_token_to_anim; \ No newline at end of file diff --git a/crates/api_clients/grok_client/src/requests/index_page/utils/parse_scripts.rs b/crates/api_clients/grok_client/src/requests/index_page/utils/parse_scripts_from_index_html.rs similarity index 83% rename from crates/api_clients/grok_client/src/requests/index_page/utils/parse_scripts.rs rename to crates/api_clients/grok_client/src/requests/index_page/utils/parse_scripts_from_index_html.rs index 5618d8e7c3..3de986e9e0 100644 --- a/crates/api_clients/grok_client/src/requests/index_page/utils/parse_scripts.rs +++ b/crates/api_clients/grok_client/src/requests/index_page/utils/parse_scripts_from_index_html.rs @@ -9,7 +9,7 @@ static SCRIPT_SELECTOR: Lazy = Lazy::new(|| { }); -pub fn parse_scripts(html: &str) -> Vec { +pub fn parse_scripts_from_index_html(html: &str) -> Vec { let document = Html::parse_document(html); let selected = document.select(&SCRIPT_SELECTOR); selected @@ -24,7 +24,7 @@ mod tests { use crate::requests::index_page::get_index_page::{get_index, GetIndexPageArgs}; use crate::test_utils::get_test_cookies::get_test_cookies; use errors::AnyhowResult; - use crate::requests::index_page::utils::parse_scripts::parse_scripts; + use crate::requests::index_page::utils::parse_scripts_from_index_html::parse_scripts_from_index_html; #[tokio::test] #[ignore] // Manual test invocation @@ -34,7 +34,7 @@ mod tests { cookie: &cookie, }).await?; - let scripts = parse_scripts(&index.body); + let scripts = parse_scripts_from_index_html(&index.body); println!("Script count: {:?}", scripts.len()); diff --git a/crates/api_clients/grok_client/src/requests/index_page/utils/parse_verification_token_from_html.rs b/crates/api_clients/grok_client/src/requests/index_page/utils/parse_verification_token_from_index_html.rs similarity index 91% rename from crates/api_clients/grok_client/src/requests/index_page/utils/parse_verification_token_from_html.rs rename to crates/api_clients/grok_client/src/requests/index_page/utils/parse_verification_token_from_index_html.rs index a987001814..17c46e874f 100644 --- a/crates/api_clients/grok_client/src/requests/index_page/utils/parse_verification_token_from_html.rs +++ b/crates/api_clients/grok_client/src/requests/index_page/utils/parse_verification_token_from_index_html.rs @@ -26,7 +26,7 @@ static JSON_REGEX: Lazy = Lazy::new(|| { pub struct VerificationToken(pub(crate) String); /// Parse the verification token from the root HTML -pub fn parse_verification_token_and_anim(html: &str) -> Option { +pub fn parse_verification_token_from_index_html(html: &str) -> Option { let maybe_meta = scrape_meta_tag_via_parsing(html); if let Some(meta) = maybe_meta { @@ -61,7 +61,7 @@ fn scrape_meta_tag_via_parsing(html: &str) -> Option { #[cfg(test)] mod tests { use crate::requests::index_page::get_index_page::{get_index, GetIndexPageArgs}; - use crate::requests::index_page::utils::parse_verification_token_from_html::parse_verification_token_and_anim; + use crate::requests::index_page::utils::parse_verification_token_from_index_html::parse_verification_token_from_index_html; use crate::test_utils::get_test_cookies::get_test_cookies; use errors::AnyhowResult; @@ -73,7 +73,7 @@ mod tests { cookie: &cookie, }).await?; - let result = parse_verification_token_and_anim(&index.body); + let result = parse_verification_token_from_index_html(&index.body); println!("{:?}", result); assert_eq!(1, 2);