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

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

Open
DarkCTO opened this issue Nov 12, 2023 · 1 comment
Open

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

DarkCTO opened this issue Nov 12, 2023 · 1 comment

Comments

@DarkCTO
Copy link

DarkCTO commented Nov 12, 2023

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
Copy link
Author

DarkCTO commented Nov 13, 2023

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')
    }

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