youtube_uploader_selenium icon indicating copy to clipboard operation
youtube_uploader_selenium copied to clipboard

This browser or app may not be secure.

Open NoString opened this issue 3 years ago • 7 comments

hi, developer. I try to use this python code, but when I login youtube, it notice me that "browser is not secure", how can I do? my firefox version is 89.0 and had installed and configure the geckodriver image

NoString avatar Jun 13 '21 12:06 NoString

I have the same issue

terahlunah avatar Jun 19 '21 09:06 terahlunah

You don't log in, just load the cookies, get them with a extension like editThisCookie

async function setCookies(channelName) { let p = require("electron").remote.app.getAppPath(); p = p.substring(0, p.lastIndexOf("\\")); let cookieJar = JSON.parse( fs.readFileSync( p + "/cookieJar/" + (channelName || "Só idéias legais!") + ".json", "utf8" ) ); cookieJar.forEach(async (cookie) => { cookie.sameSite = "None"; cookie.storeId = "None"; cookie.secure = true; await driver.manage().addCookie(cookie); }); }

rzfzr avatar Jun 20 '21 22:06 rzfzr

You don't log in, just load the cookies, get them with a extension like editThisCookie

async function setCookies(channelName) { let p = require("electron").remote.app.getAppPath(); p = p.substring(0, p.lastIndexOf("\\")); let cookieJar = JSON.parse( fs.readFileSync( p + "/cookieJar/" + (channelName || "Só idéias legais!") + ".json", "utf8" ) ); cookieJar.forEach(async (cookie) => { cookie.sameSite = "None"; cookie.storeId = "None"; cookie.secure = true; await driver.manage().addCookie(cookie); }); }

I use editthiscookie to get the same cookies for different channels

pokima avatar Aug 15 '21 00:08 pokima

@pokima yes, even the same account as manager for multiple channels/brand accounts, you can get different cookies and use them

rzfzr avatar Aug 16 '21 01:08 rzfzr

You don't log in, just load the cookies, get them with a extension like editThisCookie

async function setCookies(channelName) { let p = require("electron").remote.app.getAppPath(); p = p.substring(0, p.lastIndexOf("\\")); let cookieJar = JSON.parse( fs.readFileSync( p + "/cookieJar/" + (channelName || "Só idéias legais!") + ".json", "utf8" ) ); cookieJar.forEach(async (cookie) => { cookie.sameSite = "None"; cookie.storeId = "None"; cookie.secure = true; await driver.manage().addCookie(cookie); }); }

How do I get Login Cookies?

NoNoNe96 avatar Aug 22 '21 09:08 NoNoNe96

How do I get Login Cookies? Did you try the extension? just click the icon > export > paste them

rzfzr avatar Aug 22 '21 18:08 rzfzr

I don't quite understand.. So I run firefox I use that cookie editor extension, go to youtube while logged in, and click the export button in cookie editor, to copy the cookies.

So now I have cookie data in my clipboard.

I could put that in a file c:\thispythonproject\cookie.json

But how do I get this program to load the cookies from that file?

A comment mentions "async function setCookies(channelName) {.........}"

Well, having done a bit of javascript before, I suppose that's javascript rather than python.

Where am I meant to put that javascript line?

And I suppose straight after that line there should be a line that calls it?

I guess Selenium will run a browser or headless browser, and it's doing that so that's fine, but I suppose there must be a way to inject javascript into a page, and if injecting it into the right page then hey presto it could work.

But could anybody please explain how to do that?

(So I can go from having that cookie data, in a json file, to getting the cookies auto loaded into the browser that the program starts?)

Thanks

UPDATE-

I see a solution here that works https://github.com/linouk23/youtube_uploader_selenium/issues/39

You find firefox.py which for me is

"C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium_firefox\firefox.py"

And you find this line

    profile = webdriver.FirefoxProfile()

and you want to comment that / change that to something like he said

    #  profile= webdriver.FirefoxProfile('/home/your_user_name/.mozilla/firefox/some_letters.default-release/')

which for me on windows is

    profile= webdriver.FirefoxProfile('/Users/user/AppData/Roaming/Mozilla/Firefox/Profiles/some_letters.default-release/')

To get the exact path of the profile that has you logged into your youtube profile , you can open firefox go to help.. troubleshooting.. and it says "profile folder" and tells you the path to that folder.

Now even if I comment out that line to load my default profile, and it just uses profile = webdriver.FirefoxProfile() it seems to be loading my default profile. So all fine.

At one point when trying something I noticed that at the cmd prompt it asked me to log in and then push ENTER. So, even if it wasn't logged in, maybe there's that method too. So worth checking to see what it says at the cmd prompt.

gartha1 avatar Aug 04 '22 04:08 gartha1