fn extract_runes(first_table: Node<'_>, second_table: Node<'_>) -> RunesDataExpand description
⚙️ Function: Extracts rune data from two HTML tables.
This function processes two HTML tables (representing primary and secondary runes) and extracts
the rune images by filtering out those that are not visible (with opacity: 0.2) and by cleaning
the alt attributes of the remaining images. The function then constructs a RunesData struct
containing all rune data if exactly 9 runes are found.
§Parameters:
first_table: Aselect::node::Noderepresenting the primary rune table.second_table: Aselect::node::Noderepresenting the secondary rune table.
§Returns:
RunesData: Returns aRunesDatastruct containing the extracted rune information. If the number of runes found is not exactly 9, it returns aRunesDatastruct with empty strings for all fields.
§Example:
This function is typically called to process rune tables extracted from a web page:
let runes_data = extract_runes(primary_table, secondary_table);
println!("{:?}", runes_data);§Notes:
- The function first collects all
imgtags from both the primary and secondary rune tables. - It filters out images that have a parent
divwithopacity: 0.2and skips any image without a validaltattribute. - The
clean_alt_textfunction is applied to clean up thealttext before it is added to the final rune list. - The function expects exactly 9 runes: 4 primary runes, 2 secondary runes, and 3 tertiary runes. If this condition is not met, an empty
RunesDatastruct is returned.