Add more debug logging for title and OO_STATE extraction
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e8dfd0ba7d
commit
eec44011f4
1 changed files with 7 additions and 1 deletions
|
|
@ -174,9 +174,11 @@
|
|||
|
||||
<!--- Try to extract business name from title tag --->
|
||||
<cfset titleMatch = reMatchNoCase('<title>([^<]+)</title>', pageHtml)>
|
||||
<cfset arrayAppend(response.steps, "Title tag matches: " & arrayLen(titleMatch))>
|
||||
<cfif arrayLen(titleMatch)>
|
||||
<cfset titleText = reReplaceNoCase(titleMatch[1], '.*<title>([^<]+)</title>.*', '\1')>
|
||||
<cfset titleText = trim(titleText)>
|
||||
<cfset arrayAppend(response.steps, "Raw title text: " & left(titleText, 100))>
|
||||
<!--- Toast titles are usually "Restaurant Name | Online Ordering" --->
|
||||
<cfif findNoCase("|", titleText)>
|
||||
<cfset titleText = trim(listFirst(titleText, "|"))>
|
||||
|
|
@ -187,8 +189,12 @@
|
|||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<!--- Check if __OO_STATE__ exists in the saved HTML --->
|
||||
<cfset hasOoState = findNoCase("window.__OO_STATE__", pageHtml) GT 0>
|
||||
<cfset arrayAppend(response.steps, "Has __OO_STATE__: " & hasOoState)>
|
||||
|
||||
<!--- Also try to extract from __OO_STATE__ for images and business info --->
|
||||
<cfif findNoCase("window.__OO_STATE__", pageHtml)>
|
||||
<cfif hasOoState>
|
||||
<cfset ooStateMatch = reMatchNoCase("window\.__OO_STATE__\s*=\s*(\{.*?\});\s*window\.", pageHtml)>
|
||||
<cfif arrayLen(ooStateMatch)>
|
||||
<cfset ooStateJson = reReplaceNoCase(ooStateMatch[1], "window\.__OO_STATE__\s*=\s*", "")>
|
||||
|
|
|
|||
Reference in a new issue