ouo-bypass icon indicating copy to clipboard operation
ouo-bypass copied to clipboard

AttributeError: 'NoneType' object has no attribute 'findAll'

Open DarkCTO opened this issue 1 year ago • 1 comments

Your script works but not always, any time it can raise this error: AttributeError: 'NoneType' object has no attribute 'findAll'

with open('output_no_bypass.csv', 'r') as file:
    filedata = file.readlines()

    for line in filedata:
        print('\nBEFORE:\n',line,'\n')
        links = re.findall(REGEX, line)
        for link in links:
            if 'nxbrew.com' not in link:
                bypassed = bypass(link)
                print(link, '>>', bypassed)
                line = line.replace(link, bypassed)
        print('\nAFTER:\n',line,'\n')
        with open('output_bypass.csv', 'a') as output:
          output.write(line)
BEFORE:
 #1 Anagrams Sudokus Bundle,https://nxbrew.com/1-anagrams-sudokus-bundle-switch-nsp-eshop/,"Mar 04, 2022",Puzzle,Eclipse Games,eShop,NSP,01007360179AE000,207 MB,English,12.0.0,12.0.0 + Atmosphere 0.19.0,"{'1Fichier': [['https://ouo.io/nWfmKG9']], 'Google Drive': [['https://ouo.io/A88VyD']], 'MegaUp': [['https://ouo.io/VJ5pXp']]}",{},{},{},{},{},{},{},{},{},{},{},{},{},{}
 

https://ouo.io/nWfmKG9 >> https://1fichier.com/?dj796bxcrk3jdk3lk7lf&af=327151
Traceback (most recent call last):
  File "/run/media/kudy/DATA/Projects/Parser/bypass.py", line 100, in <module>
    bypassed = bypass(link)
  File "/run/media/kudy/DATA/Projects/Parser/bypass.py", line 86, in bypass
    bypassed = ouo_bypass(url)['bypassed_link']
  File "/run/media/kudy/DATA/Projects/Parser/bypass.py", line 55, in ouo_bypass
    inputs = bs4.form.findAll("input", {"name": re.compile(r"token$")})
AttributeError: 'NoneType' object has no attribute 'findAll'

DarkCTO avatar Nov 12 '23 19:11 DarkCTO

This is due to seemingly random 500 Error claiming something went wrong on their server. And due to this error, the form gives None.

Temporary Fix is to keep trying:

def ouo_bypass(url):
    result = None
    while result is None:
        try:
            tempurl = url.replace("ouo.press", "ouo.io")
            p = urlparse(tempurl)
            id = tempurl.split('/')[-1]
            res = client.get(tempurl, impersonate="chrome110")
            next_url = f"{p.scheme}://{p.hostname}/go/{id}"

            for _ in range(2):
                if res.headers.get('Location'): break
                bs4 = BeautifulSoup(res.content, 'lxml')
                result = bs4.form
                inputs = bs4.form.findAll("input", {"name": re.compile(r"token$")})
                data = { input.get('name'): input.get('value') for input in inputs }
                data['x-token'] = RecaptchaV3()
                
                h = {
                    'content-type': 'application/x-www-form-urlencoded'
                }
                
                res = client.post(next_url, data=data, headers=h, 
                    allow_redirects=False, impersonate="chrome110")
                next_url = f"{p.scheme}://{p.hostname}/xreallcygo/{id}"
        except:
            pass

    return {
        'original_link': url,
        'bypassed_link': res.headers.get('Location')
    }

DarkCTO avatar Nov 13 '23 00:11 DarkCTO