question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]'NoneType' object has no attribute 'span'

See original GitHub issue

i just got the same error 3 days ago. I changed name = 'hha' and it worked. now it shows the same error. please help me out ad give a permanent solution. till yesterday it worked well, but today it seems to be fixed

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:46

github_iconTop GitHub Comments

34reactions
ifahadonecommented, Feb 12, 2022

name = re.escape(get_throttling_function_name(js))

then replace get_throttling_function_name function as follows

def get_throttling_function_name(js: str) -> str:
    """Extract the name of the function that computes the throttling parameter.

    :param str js:
        The contents of the base.js asset file.
    :rtype: str
    :returns:
        The name of the function used to compute the throttling parameter.
    """
    function_patterns = [
        # https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-865985377
        # a.C&&(b=a.get("n"))&&(b=Dea(b),a.set("n",b))}};
        # In above case, `Dea` is the relevant function name
        r'a\.[A-Z]&&\(b=a\.get\("n"\)\)&&\(b=([^(]+)\(b\)',
    ]
    logger.debug('Finding throttling function name')
    for pattern in function_patterns:
        regex = re.compile(pattern)
        function_match = regex.search(js)
        if function_match:
            logger.debug("finished regex search, matched: %s", pattern)
            function_name = function_match.group(1)
            is_Array = True if '[' in function_name or ']' in function_name else False
            if is_Array:
                index = int(re.findall(r'\d+', function_name)[0])
                name = function_name.split('[')[0]
                pattern = r"var %s=\[(.*?)\];" % name
                regex = re.compile(pattern)
                return regex.search(js).group(1).split(',')[index]
            else:
                return function_name

    raise RegexMatchError(
        caller="get_throttling_function_name", pattern="multiple"
    )
8reactions
ImranRahimov1995commented, Feb 8, 2022

Cipher.py

def get_throttling_function_code(js: str) -> str: name = ‘sha’

Today short way ))))

For show it s working: https://youtube.impropy.me/

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytube: AttributeError: 'NoneType' object has no attribute 'span'
The issue is that the regex expects a function with an argument, but I guess youtube added some src that includes non-paramterized functions....
Read more >
[BUG] 'NoneType' object has no attribute 'span' #1218 - GitHub
You can do this by running python -m pip install git+https://github.com/pytube/pytube . Sometimes, the pypi library repository is not up to date ...
Read more >
[Example code]-pytube: 'NoneType' object has no attribute 'span'
I try to follow pytube example for downloading video from YouTube: from pytube import YouTube video = YouTube('https://www.youtube.com/watch?v=BATOxzbVNno') ...
Read more >
How do I fix : attributeerror: 'nonetype' object has no attribute ...
When ever you get a problems that involves a message such as " 'nonetype' object has no attribute ..." it means the same...
Read more >
attributeerror 'nonetype' object has no attribute 'text ... - You.com
You are getting the error because there are certain None values if you try to scrape directly. For eg: After the name Naksh...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found