Created
December 8, 2023 16:03
-
-
Save neopheus/e4fe5ed6715a3b5a8c2528a5a2ff6577 to your computer and use it in GitHub Desktop.
Uber Eats Download Invoice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
| const downloadInvoice = async (orderUUID) => { | |
| try { | |
| console.log(`Downloading invoice for order UUID: ${orderUUID}`); | |
| const invoiceResponse = await fetch('https://www.ubereats.com/_p/api/getInvoiceFilesV1?localeCode=fr', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', 'x-csrf-token': 'x' }, // Remplacez 'x' par votre token CSRF réel | |
| body: JSON.stringify({ orderUUID }), | |
| }); | |
| const invoiceData = await invoiceResponse.json(); | |
| if (invoiceData.status === "success" && invoiceData.data.files) { | |
| invoiceData.data.files.forEach(file => { | |
| const a = document.createElement("a"); | |
| a.href = file.downloadURL; | |
| a.download = ""; // Le nom du fichier sera déduit de l'URL | |
| document.body.appendChild(a); | |
| a.click(); | |
| window.URL.revokeObjectURL(a.href); | |
| a.remove(); | |
| }); | |
| console.log(`Invoice for order ${orderUUID} downloaded.`); | |
| } | |
| await delay(1000); // Attente de 1 seconde entre chaque téléchargement | |
| } catch (error) { | |
| console.error('Error downloading invoice:', error); | |
| } | |
| }; | |
| const fetchAllOrders = async (lastWorkflowUUID = '') => { | |
| console.log('Fetching orders...'); | |
| const res = await fetch('/api/getPastOrdersV1?localeCode=fr', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', 'x-csrf-token': 'x' }, | |
| credentials: 'include', | |
| body: JSON.stringify({ lastWorkflowUUID }), | |
| }); | |
| const { data } = await res.json(); | |
| for (const order of Object.values(data.ordersMap)) { | |
| await downloadInvoice(order.baseEaterOrder?.uuid); | |
| } | |
| console.log('Batch of orders processed.'); | |
| if (data.meta?.hasMore) { | |
| const lastOrder = Object.values(data.ordersMap).pop(); | |
| await delay(5000); // Attente de 5 secondes avant de récupérer le prochain lot | |
| return fetchAllOrders(lastOrder.baseEaterOrder?.uuid); | |
| } else { | |
| console.log('All orders processed and invoices downloaded.'); | |
| } | |
| }; | |
| fetchAllOrders(); |
Author
(async () => {
let count = 0;
while (true) {
// Cherche le bouton dont le texte contient "Voir plus"
const buttons = [...document.querySelectorAll("button")];
const voirPlus = buttons.find(b => b.textContent.trim().toLowerCase().includes("voir plus"));
if (!voirPlus) {
console.log("✅ Plus de bouton 'Voir plus' trouvé — toutes les commandes sont affichées !");
break;
}
voirPlus.scrollIntoView({ behavior: "smooth", block: "center" });
voirPlus.click();
count++;
console.log(`🟢 Clic n°${count} sur "Voir plus"`);
await new Promise(r => setTimeout(r, 1500)); // pause entre les clics
}
})();
Author
(async () => {
const boutons = [...document.querySelectorAll('a, button')]
.filter(el => el.textContent.trim().toLowerCase().includes('télécharger la facture'));
console.log(`📄 ${boutons.length} factures détectées.`);
for (const [i, bouton] of boutons.entries()) {
bouton.scrollIntoView({ behavior: "smooth", block: "center" });
console.log(`⬇️ Clic ${i + 1}/${boutons.length} sur "Télécharger la facture"`);
bouton.click();
await new Promise(r => setTimeout(r, 1500)); // pause entre les clics
}
console.log("✅ Tous les boutons 'Télécharger la facture' ont été cliqués.");
})();@neopheus ahah t un boss merci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for this super usefull gist. Do you have the same for uber trips by any chance?