# -*- coding: utf-8 -*-
"""
Created on Mon Aug  6 15:53:10 2018

@author: zhouyujiang
"""

import re

def calculate_kwai_video_id_by_data_by_url(kwai_url):
    doc_id_str = re.findall(r"/u/(.+)?|/photo/(.+)?",kwai_url)
    if doc_id_str!=[]:
        for i in doc_id_str[0]:
            if i!='':
                vid = str(i).replace('/','_')
                return vid
    else:
        return None


if __name__=='__main__':
    print(calculate_kwai_video_id_by_data_by_url('https://www.kuaishou.com/u/143139353/5601747480'))
