

def is_youtube_video(link):
    "Identify youtube video's."
    content = urllib2.unquote(link).decode('utf8')
    result = re.search('http://youtu.be', content, flags=re.IGNORECASE)
    if (result is None):
        result = re.search('www.youtube.com', content, flags=re.IGNORECASE)
        if (result is None):
            return False
        else:
            video_prefix = 'watch?v='
    else:
        video_prefix = 'youtu.be/'
    try:
        logging.info(content)
        id_pos = (content.index(video_prefix) + len(param_pos))
        video_id = content[id_pos:]
        try:
            param_pos = video_id.index('&')
            video_id_trimed = video_id[:param_pos]
        except ValueError:
            video_id_trimed = video_id
    except ValueError:
        logging.info('badly formed video url')
        return False
    return video_id_trimed

dataset/ETHPy150Open GoogleDeveloperExperts/experts-app-backend/services/update_gplus.py is_youtube_video/VarMisuse@124/174 `video_prefix`->`param_pos`