jef / streetmerchant

🤖 The world's easiest, most powerful stock checker
https://jef.buzz/streetmerchant
MIT License
4.97k stars 1.3k forks source link

Please Add PC-Canada #894

Closed BigShoots closed 3 years ago

BigShoots commented 3 years ago

I've manually added myself, but would be nice if you could incorporate PC-Canada so I don't have to manually add all the cards.

Thanks!

BigShoots commented 3 years ago

This is what I used to find if the item is out of stock and the price.

labels: {
    maxPrice: {
        container:
            '.shop-item-description .shop-price > div',
        euroFormat: false
    },
    outOfStock: {
        container:
            '.col-sm-4 .shop-stock-prod',
        text: ['Backordered']
    }
abeth66 commented 3 years ago

How did you manually add pccanada? I've created a .ts file for the store and added it to the .env; however, streetmerchant does not recognize it when I run: mintty 2020-11-23_14-55-08 I must need to register the store elsewhere in the program, but where?

BigShoots commented 3 years ago

@abeth66 I just used a pre-existing store's .ts file and replaced the contents with my PC-Canada code. In my case I used the PNY store.

abeth66 commented 3 years ago

Unfortunately, I still can't get streetmerchant to recognize pccanada despite having cloned and modified pccanada.ts from memoryexpreess.ts: mintty 2020-11-24_11-50-47

My pccanada.ts:

import {Store} from './store';

export const PCCanada: Store = {
    labels: {
        inStock: {
            container: 'div[class="instockcontainer-dbonly hide"]',
            text: ['in stock']
        }
    },
    links: [
        {
            brand: 'test:brand',
            model: 'test:model',
            series: 'test:series',
            url: 'https://www.pc-canada.com/item/G1050TGX4.html'
        },
        {
            brand: 'asus',
            model: 'tuf',
            series: '3080',
            url: 'https://www.pc-canada.com/item/TUF-RTX3080-10G-GAMING.html'
        },
        {   brand: 'asus',
            model: 'tuf oc',
            series: '3080',
            url: 'https://www.pc-canada.com/item/TUF-RTX3080-O10G-GAMING.html'}
    ],
    name: 'pccanada',
    waitUntil: 'domcontentloaded'
};

Any help would be appreciated.

On a side note, can anyone tell me where to get started on learning about this code? Any courses, resources, specific code I can start to learn? I have ZERO coding knowledge and want to start learning.

BigShoots commented 3 years ago

I replaced the contents of the pny.ts file with my pccanada code and then enabled pny in my env file.

abeth66 commented 3 years ago

Thank you for the workaround. I was able to get pccanada.ts to work by writing it into streetmerchant\src\store\index.ts

BigShoots commented 3 years ago

@abeth66 Great, I knew there had to be a way, but couldn't figure it out. I've used your method now as its more desirable.