Skip to content

Instantly share code, notes, and snippets.

@guillaumegarcia13
Created July 18, 2025 08:13
Show Gist options
  • Select an option

  • Save guillaumegarcia13/24997193a7731e747a60737f4adc499d to your computer and use it in GitHub Desktop.

Select an option

Save guillaumegarcia13/24997193a7731e747a60737f4adc499d to your computer and use it in GitHub Desktop.
🗳️ Suivi du nombre de votes de la pétition contre la loi Duplomb
(function(){if(!window.pc)window.pc={d:null,l:0,i:false};const c=window.pc,n=Date.now(),m=5*60*1000,r=(n-c.l)>=m;if(r&&!c.i){c.i=true;(async()=>{try{const res=await fetch('https://petitions.assemblee-nationale.fr/initiatives/i-3014');const html=await res.text();const doc=new DOMParser().parseFromString(html,'text/html');const el=doc.querySelector('#initiative-3014-votes-count > div.progress__bar__title > span.progress__bar__number');c.d={v:el?.textContent?.trim()||'N/A',t:new Date().toLocaleTimeString(),s:true};c.l=n;}catch(e){c.d={v:'Error',t:new Date().toLocaleTimeString(),s:false,e:e.message};c.l=n;}finally{c.i=false;}})();}return c.i?`🔄 Loading...`:(c.d?`🗳️ ${c.d.v} | ${c.d.t} | Next: ${new Date(c.l+m).toLocaleTimeString()}`:`⏳ Init...`);})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment