From b4c0f8d259f5df7f9058e16642633b2f59802266 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Sat, 4 Feb 2023 02:37:52 -0500 Subject: [PATCH] [+] Usage guide --- README.md | 19 +++++++++++++++++++ mobile.py | 4 ++-- taobao-bought-items.js => taobao.js | 0 3 files changed, 21 insertions(+), 2 deletions(-) rename taobao-bought-items.js => taobao.js (100%) diff --git a/README.md b/README.md index d4b28d2..f796bb1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,22 @@ # Superbuy Automatically add Taobao orders to Superbuy + + +## Usage Guide + +### Installation + +1. Clone/download this repo +2. Install Tampermonkey on your default browser +3. Create a new userscript, copy-and-paste the content of `taobao.js` +4. Install python>=3.9 (tested on 3.11) +5. `pip install -r requirements.txt` +6. Fill in your email and password in `auth.toml` + +### Usage + +1. Login to taobao +2. `python mobile.py` will open a browser tab and close it after it syncs all orders + +Note: If you have manually-added orders before using this script, you can change the `MIN_DATE` variable in `mobile.py` to the date of the first order you want to sync. diff --git a/mobile.py b/mobile.py index 8ca79b8..4af26c2 100644 --- a/mobile.py +++ b/mobile.py @@ -25,7 +25,7 @@ r.headers.update({ 'app-key': 'aaa', }) - +MIN_DATE = '2023-01-01' CONFIG_PATH = Path('.config/superbuy') @@ -114,7 +114,7 @@ def create_diy_order(create: list[TaobaoOrder]): """ orders = gateway_order_list() ids = [get_url_param(i.GoodsLink, 'id') for o in orders for i in o.Items if 'id=' in i.GoodsLink] - create = [o for o in create if o.date >= '2023-01-01' and not any(get_url_param(i.url, 'id') in ids for i in o.items)] + create = [o for o in create if o.date >= MIN_DATE and not any(get_url_param(i.url, 'id') in ids for i in o.items)] for c in create: shop_name = c.store.name shop_id = crawl(c.items[0].url)['data']['shop']['shopId'] diff --git a/taobao-bought-items.js b/taobao.js similarity index 100% rename from taobao-bought-items.js rename to taobao.js