Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Help #5

Open
asdat3 opened this issue Nov 11, 2021 · 0 comments
Open

Need Help #5

asdat3 opened this issue Nov 11, 2021 · 0 comments

Comments

@asdat3
Copy link

asdat3 commented Nov 11, 2021

Hey,
I am sorry I feel like a total idiot but I really need help here:

I want basicly the same but read the urls to request from the Chrome Storage and then scrape the site and return the result.

I noticed you are using:
var BG = chrome.extension.getBackgroundPage();

to create a Background page, I got that far aswell, but I cant find how to open a url on that page (not in the web and not in your code)

my tried code:

function backgroundFunction (BG) {
    chrome.storage.local.get(['teststorage'], async (data) => {
        let profile = data.teststorageurl;

        let products_counter = 0;
        let product_list = document.querySelectorAll('[role="tkg"]').forEach(function (el){
            products_counter++

            let comment_var_now = el.getElementsByClassName("comments")[0].textContent;

            let url_full_list_now = el.getElementsByTagName('a')[0].href;

            if(parseFloat(comment_var_now .replace(",","."))<=parseFloat(profile.storagenormalammount.replace(",","."))){ 
                if(url_full_list_now.includes("assets")){
                    var product_url_now = url_full_list_now;
                    console.log(product_url_now);
                    open_checkout(product_url_now,profile)
                };
            };
        });

        console.log('Offers found count: ' + products_counter)
    });
}

(function () {
    var BG = chrome.extension.getBackgroundPage();
    BG.href = "https://www.youtube.com/watch?v=hidden";

    BG.backgroundFunction(BG); 
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant