Skip to content

Instantly share code, notes, and snippets.

@vavrecan
Last active April 27, 2023 14:56
Show Gist options
  • Save vavrecan/2bca846507d8b36c2c15d613d84296c7 to your computer and use it in GitHub Desktop.
Save vavrecan/2bca846507d8b36c2c15d613d84296c7 to your computer and use it in GitHub Desktop.
1. resend all rides to your email throught app (manual clicking but not so bad)
2. in gmail, go to settings and disable conversation mode view
3. select all emails from bold and right click to send as attachement
4. send this email to yourself
5. download all attachements
6. (optinal) revert settings in step 2.
download invoices using bash:
for f in * ; do
URL=`grep -roh "$f" -e 'https:\/\/invoice.taxify.eu\/[^"]*'`
INVOICE=`grep -roh "$f" -e 'Invoice no. [0-9]*'`
DATE=`grep -roh "$f" -e '[0-9][0-9]\.[0-9][0-9]\.20[0-9][0-9]'`
wget -O "$DATE - $INVOICE.pdf" "$URL";
done
@olso
Copy link

olso commented Jul 15, 2020

nice

@albttx
Copy link

albttx commented Apr 27, 2023

I had to do it too, here is another solution:

  1. Select and Send all email as attachment
  2. download the .zip file with all the email as .eml
  3. go on the url of one and in network, get the cookies

update this script

#!/usr/bin/env python3

import os
import re
import sys
import requests
from pathlib import Path
from datetime import datetime
from urllib.parse import urlparse

from email import message_from_file
from email.message import Message


def find_invoice_urls_and_dates(directory):
    invoice_data = []

    # Iterate through all .eml files in the specified directory
    for file in Path(directory).rglob("*.eml"):
        with open(file, "r") as eml_file:
            content = message_from_file(eml_file).get_payload(decode=True).decode('utf-8')
            url_match = re.search(r'https:\/\/invoice.taxify.eu\/[^"]*', content)

            if url_match:
                invoice_url = url_match.group(0) #.replace('\n', '')
                print(invoice_url)
                invoice_data.append(invoice_url)
            else:
                print("ERROR NOT PARSED")
                sys.exit(1)

    return invoice_data

cookies = {
    'PHPSESSID': ''<FILL HERE THE COOKIES>",
    '__cf_bm': ''<FILL HERE>",
}

headers = {
    'authority': 'invoice.taxify.eu',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
    'accept-language': 'en-US,en;q=0.6',
    'cache-control': 'no-cache',
    'pragma': 'no-cache',
    'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Brave";v="108"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Linux"',
    'sec-fetch-dest': 'document',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'none',
    'sec-fetch-user': '?1',
    'sec-gpc': '1',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
}


directory = "."
invoice_data = find_invoice_urls_and_dates(directory)

print("Invoice data:")
for url in invoice_data:
    invoice_id = url.split('s=')[1]
    params = {
        's': invoice_id,
    }

    response = requests.get('https://invoice.taxify.eu/', params=params, cookies=cookies, headers=headers)
    if response.status_code != 200:
        print("ERROR on ", params['s'])
        sys.exit(1)

    file_name = "bolt_" + invoice_id + ".pdf"
    with open(file_name, "wb") as f:
        f.write(response.content)
        print(file_name)
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment