This commit is contained in:
Brandon Thomas committed 2025-10-28 01:18:22 -04:00
1 parent ad0c2d0cfb
commit dadf17ebcc
5 files changed
+12 -12

No files matched your search

@@ -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());
@@ -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,
@@ -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;
@@ -9,7 +9,7 @@ static SCRIPT_SELECTOR: Lazy<Selector> = Lazy::new(|| {
});
pub fn parse_scripts(html: &str) -> Vec<String> {
pub fn parse_scripts_from_index_html(html: &str) -> Vec<String> {
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());
@@ -26,7 +26,7 @@ static JSON_REGEX: Lazy<Regex> = 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<VerificationToken> {
pub fn parse_verification_token_from_index_html(html: &str) -> Option<VerificationToken> {
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<String> {
#[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);