Add debug: Beverages HTML snippet to see subcategory structure
This commit is contained in:
parent
794d2ceee5
commit
361e54c17a
1 changed files with 14 additions and 8 deletions
|
|
@ -265,15 +265,21 @@
|
|||
</cfloop>
|
||||
<cfset response["DEBUG_H4_TAGS"] = h4Texts>
|
||||
|
||||
<!--- Debug: find menuGroup and menuSection divs --->
|
||||
<cfset menuGroupMatches = reMatchNoCase("<div[^>]*class=""[^""]*menuGroup[^""]*""[^>]*>", combinedHtml)>
|
||||
<cfset menuSectionMatches = reMatchNoCase("<section[^>]*class=""[^""]*menuSection[^""]*""[^>]*>", combinedHtml)>
|
||||
<cfset response["DEBUG_MENU_GROUPS"] = arrayLen(menuGroupMatches)>
|
||||
<cfset response["DEBUG_MENU_SECTIONS"] = arrayLen(menuSectionMatches)>
|
||||
<!--- Debug: find all heading tags --->
|
||||
<cfset h2Tags = reMatchNoCase("<h2[^>]*>([^<]*)</h2>", combinedHtml)>
|
||||
<cfset h5Tags = reMatchNoCase("<h5[^>]*>([^<]*)</h5>", combinedHtml)>
|
||||
<cfset h6Tags = reMatchNoCase("<h6[^>]*>([^<]*)</h6>", combinedHtml)>
|
||||
<cfset response["DEBUG_H2_COUNT"] = arrayLen(h2Tags)>
|
||||
<cfset response["DEBUG_H5_COUNT"] = arrayLen(h5Tags)>
|
||||
<cfset response["DEBUG_H6_COUNT"] = arrayLen(h6Tags)>
|
||||
|
||||
<!--- Extract all span/div text that might be subcategory headers --->
|
||||
<cfset subcatHeaders = reMatchNoCase("<(span|div)[^>]*class=""[^""]*header[^""]*""[^>]*>([^<]+)<", combinedHtml)>
|
||||
<cfset response["DEBUG_SUBCAT_HEADERS"] = subcatHeaders>
|
||||
<!--- Show first 1000 chars of HTML around "Beverages" to see structure --->
|
||||
<cfset bevPos = findNoCase("Beverages", combinedHtml)>
|
||||
<cfif bevPos GT 0>
|
||||
<cfset bevStart = max(1, bevPos - 100)>
|
||||
<cfset bevEnd = min(len(combinedHtml), bevPos + 900)>
|
||||
<cfset response["DEBUG_BEVERAGES_HTML"] = mid(combinedHtml, bevStart, bevEnd - bevStart)>
|
||||
</cfif>
|
||||
<cfset arrayAppend(response.steps, "Found " & arrayLen(h3Texts) & " h3 and " & arrayLen(h4Texts) & " h4 tags")>
|
||||
|
||||
<!--- System prompt for URL analysis --->
|
||||
|
|
|
|||
Reference in a new issue