def get_url_data(self, url):
        parsed_url = urlparse.urlsplit(url)
        if parsed_url.scheme in ('http', 'https'):
            if parsed_url.netloc in ('youtube.com', 'www.youtube.com'):
                match = self.path_re.match(parsed_url.path)
                if match:
                    groupdict = match.groupdict()
                    if groupdict['username'] not in self.invalid_usernames:
                        if groupdict['user'] is None:
                            # Some URLs at root are a kind of vanity URL that
                            # doesn't correspond to a username. The only way
                            # to be sure is to actually fetch the page and
                            # check for a canonical url.
                            response = requests.get(url)
                            if response.status_code == 200:
                                strainer = SoupStrainer('link',
                                                        rel='canonical')
                                soup = BeautifulSoup(response.content,
                                                     parse_only=strainer)
                                if soup.link is not None:
                                    return self.get_url_data(soup.link['href'])
                        else:
                            return {'username': groupdict['username']}

                match = self.old_path_re.match(parsed_url.path)
                if match:
                    parsed_qs = urlparse.parse_qs(parsed_url.query)
                    if 'user' in parsed_qs:
                        username = parsed_qs['user'][0]
                        if username not in self.invalid_usernames:
                            return {'username': username}
            elif parsed_url.netloc == 'gdata.youtube.com':
                match = self.gdata_re.match(parsed_url.path)
                if match:
                    return match.groupdict()

        raise UnhandledFeed(url)
dataset/ETHPy150Open pculture/vidscraper/vidscraper/suites/youtube.py/Feed.get_url_data/original