def format_video_search(videoID): # 形式がsmか判定 # XML形式からreadできる形式に変換 xml_video = video_parse.XML_VideoData("http://ext.nicovideo.jp/api/getthumbinfo/sm", str(videoID)) root = xml_video.video_parse() if "sm" in str(root[0][0].text): return "sm" # 形式がsoか判定 else: # XML形式からreadできる形式に変換 xml_video = video_parse.XML_VideoData("http://ext.nicovideo.jp/api/getthumbinfo/so", str(videoID)) root = xml_video.video_parse() if "so" in str(root[0][0].text): return "so" # 形式がnmか判定 else: # XML形式からreadできる形式に変換 xml_video = video_parse.XML_VideoData("http://ext.nicovideo.jp/api/getthumbinfo/nm", str(videoID)) root = xml_video.video_parse() if "nm" in str(root[0][0].text): return "nm" else: return "novideo"
def format_video_search(videoID): # XML形式からreadできる形式に変換 sm_xml_video = video_parse.XML_VideoData( "http://ext.nicovideo.jp/api/getthumbinfo/sm", str(videoID)) so_xml_video = video_parse.XML_VideoData( "http://ext.nicovideo.jp/api/getthumbinfo/so", str(videoID)) nm_xml_video = video_parse.XML_VideoData( "http://ext.nicovideo.jp/api/getthumbinfo/nm", str(videoID)) sm_root = sm_xml_video.video_parse() so_root = so_xml_video.video_parse() nm_root = nm_xml_video.video_parse() # 形式がsmか判定 if "sm" in str(sm_root[0][0].text): return "sm" else: video_no_found = "novideo" # 形式がsoか判定 if "so" in str(so_root[0][0].text): return "so" else: video_no_found = "novideo" # 形式がnmか判定 if "nm" in str(nm_root[0][0].text): return "nm" else: video_no_found = "novideo" return video_no_found
def __init__(self, videoID): # XML形式からreadできる形式に変換 xml_video = video_parse.XML_VideoData("http://ext.nicovideo.jp/api/getthumbinfo/", str(videoID)) xml = xml_video.video_parse() #tree = ElementTree.parse(xml) #root = xml.getroot() #self.root = root self.xml = xml
def video_info(videoID): # XML形式からreadできる形式に変換 xml_video = video_parse.XML_VideoData( "http://ext.nicovideo.jp/api/getthumbinfo/", str(videoID)) root = xml_video.video_parse() video_info = list() # タイトル video_info.append(str(root[0][1].text)) # 動画ID video_info.append(root[0][0].text) return video_info
import time import video_parse videoID = "sm9333876" xml_video = video_parse.XML_VideoData( "http://ext.nicovideo.jp/api/getthumbinfo/", str(videoID)) xml = xml_video.video_parse() time = xml[0][5].text if time == '0': print("okok") # m, s = [int(i) for i in time.split(':')] # time = 60*m + s
def __init__(self, videoID): # XML形式からreadできる形式に変換 xml_video = video_parse.XML_VideoData( "http://ext.nicovideo.jp/api/getthumbinfo/", str(videoID)) xml = xml_video.video_parse() self.xml = xml