PageSourceSearch

https://scripti.ai/assets/HookGenerator-DKmtKJaL.js

js scripti.ai collected 2026-10-05 12:37:46 UTC 3,470 bytes, 1 lines download raw bytes

1import{ac as w,j as e,Z as v,I as C,B as F,S as E,r as P}from"./index-DvzsaPdx.js";import{b as a}from"./vendor-react-CheUFHf5.js";import{E as _}from"./EmailCapture-uXkdJo8I.js";import{F as H,a as I,b as N,c as O,d as B,e as G,f as L}from"./FreeTools-BHjF4kLN.js";import"./vendor-supabase-BZ0N5lZN.js";import"./vendor-posthog-ChS_LCTc.js";import"./BrandUnderline-B-ocp53h.js";const M="https://youtubersystems-api-eu.onrender.com",$=[{value:"topic",label:"Topic"},{value:"script",label:"Script"}],A={topic:"Enter the idea and get five opening directions designed to earn the next thirty seconds.",script:"Paste the draft and get five openings that set up the promise the script actually delivers."},R=["Question hook","Bold claim","Story hook","Statistic hook","Contrarian take"];function W(){w("Free YouTube Hook Generator",{description:"Generate 5 compelling opening hooks for your YouTube video. Free, no signup.",canonicalPath:"/hooks"});const[r,f]=a.useState("topic"),[s,c]=a.useState(""),[i,p]=a.useState([]),[u,h]=a.useState(!1),[d,n]=a.useState(""),[j,g]=a.useState(null),k=t=>{f(t),c(""),p([]),n("")},x=async t=>{if(t.preventDefault(),!(!s.trim()||u)){h(!0),n(""),p([]);try{const o=r==="script"?{script:s.trim()}:{topic:s.trim()},l=await fetch(`${M}/api/free-tools/hook-generator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(l.status===429){n("Rate limit reached. Please try again in an hour.");return}if(!l.ok){const S=await l.json().catch(()=>({}));n(S.detail||"Something went wrong. Please try again.");return}const m=await l.json();p(m.hooks||[]),P("free_tool_used",{tool:"hook-generator",input_mode:r,result_count:m.hooks?.length||0})}catch{n("Network error. Please check your connection and try again.")}finally{h(!1)}}},b=(t,o)=>{navigator.clipboard.writeText(t),g(o),setTimeout(()=>g(null),2e3)},y=r==="script"?"packaging":"draft",T=r==="script"?"From hook generator script":"From hook generator topic";return e.jsxs(H,{children:[e.jsx(I,{backHref:"/tools",title:"Open with a stronger",accent:"hook.",description:A[r],children:e.jsx(N,{value:r,options:$,onChange:k})}),e.jsxs(O,{children:[e.jsx(B,{children:e.jsxs("form",{onSubmit:x,children:[r==="script"?e.jsx(v,{label:"Your Script",placeholder:"Paste your script or transcript here...",value:s,onChange:t=>c(t.target.value),rows:5,autoExpand:!0,maxHeight:400,maxLength:15e3}):e.jsx(C,{label:"Video Topic",placeholder:"e.g. The YouTube workflow I wish I used sooner",value:s,onChange:t=>c(t.target.value),maxLength:500}),e.jsx(F,{type:"submit",disabled:!s.trim()||u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(E,{size:14}),"Generating..."]}):"Generate hooks"})]})}),d&&e.jsx(G,{children:d}),i.length>0&&e.jsx(L,{title:"Opening directions",meta:e.jsxs("span",{children:[i.length," complete options"]}),children:e.jsx("ol",{className:"free-tool-result-list",children:i.map((t,o)=>e.jsxs("li",{className:"free-tool-result-row free-tool-result-row--stacked",children:[e.jsxs("div",{children:[e.jsx("span",{className:"free-tool-result-row__label",children:R[o]||`Hook ${o+1}`}),e.jsx("p",{className:"free-tool-result-row__copy",children:t})]}),e.jsx("button",{type:"button",className:"free-tool-action",onClick:()=>b(t,o),"aria-label":`Copy hook ${o+1}`,children:j===o?"Copied":"Copy"})]},`${t}-${o}`))})}),i.length>0&&e.jsx(_,{sourceTool:"hook-generator",sourceText:s,sourceLabel:T,projectGoal:y,projectCta:"Build the full project"})]})]})}export{W as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.