Beispiel #1
0
 def _build_instance(plain: dict) -> WebKnowledge:
     __returns = WebKnowledge()
     __returns.plain = plain
     for i in get_attr(plain, "results"):
         __returns.results.append(WebKnowledgeDetail._build_instance(i))
     __returns.title = get_attr(plain, "title")
     return __returns
Beispiel #2
0
 def _build_instance(plain: dict) -> WebKnowledgeDetail:
     __returns = WebKnowledgeDetail()
     __returns.plain = plain
     __returns.des = get_attr(plain, "des")
     __returns.image = get_attr(plain, "image")
     __returns.title = get_attr(plain, "title")
     __returns.url = get_attr(plain, "url")
     return __returns
Beispiel #3
0
 def _build_instance(plain: dict) -> WebReyi:
     __returns = WebReyi()
     __returns.plain = plain
     if get_attr(plain, "results") is not None:
         for i in get_attr(plain, "results"):
             __returns.results.append(WebReyiDetail._build_instance(i))
     __returns.total = get_attr(plain, "total")
     __returns.url = get_attr(plain, "url")
     return __returns
Beispiel #4
0
 def _build_instance(plain: dict) -> WebVideo:
     __returns = WebVideo()
     __returns.plain = plain
     for i in get_attr(plain, "results"):
         __returns.results.append(WebVideoDetail._build_instance(i))
     for i in get_attr(plain, "tags"):
         __returns.tags.append(WebVideoTag._build_instance(i))
     __returns.url = get_attr(plain, "url")
     return __returns
Beispiel #5
0
 def _build_instance(plain: dict) -> WebReyiDetail:
     __returns = WebReyiDetail()
     __returns.plain = plain
     __returns.author = get_attr(plain, "author")
     __returns.author_avatar = get_attr(plain, "author_avatar")
     __returns.comments = get_attr(plain, "comments")
     __returns.des = get_attr(plain, "des")
     if get_attr(plain, "images") is not None:
         for i in get_attr(plain, "images"):
             __returns.images.append(i)
     __returns.likes = get_attr(plain, "likes")
     __returns.origin = get_attr(plain, "origin")
     __returns.pub_time = convert_time(get_attr(plain, "pub_time"))
     __returns.site = get_attr(plain, "site")
     return __returns
Beispiel #6
0
 def _build_instance(plain: dict) -> WebVideoNormal:
     __returns = WebVideoNormal()
     __returns.plain = plain
     __returns.poster = get_attr(plain, "poster")
     __returns.title = get_attr(plain, "title")
     __returns.url = get_attr(plain, "url")
     __returns.duration = time(
         minute=int(get_attr(plain, "duration").split(":")[0]),
         second=int(get_attr(plain, "duration").split(":")[1]),
     )
     __returns.origin = get_attr(plain, "origin")
     for i in get_attr(plain, "labels"):
         __returns.info.append(i)
     if get_attr(plain, "info") is not None:
         for i in get_attr(plain, "info"):
             __returns.info.append(WebVideoNormalInfo._build_instance(i))
     __returns.video_num = get_attr(plain, "video_num")
     return __returns
Beispiel #7
0
 def _build_instance(plain: dict) -> WebVideoDetail:
     __returns = WebVideoDetail()
     __returns.plain = plain
     __returns.author = get_attr(plain, "author")
     __returns.author_avatar = get_attr(plain, "author_avatar")
     try:
         __returns.duration = time(
             minute=int(get_attr(plain, "duration").split(":")[0]),
             second=int(get_attr(plain, "duration").split(":")[1]),
         )
     except:
         __returns.duration = None
     for i in get_attr(plain, "labels"):
         __returns.labels.append(i)
     __returns.poster = get_attr(plain, "poster")
     __returns.pub_time = convert_time(get_attr(plain, "pub_time"))
     __returns.title = get_attr(plain, "title")
     __returns.url = get_attr(plain, "url")
     __returns.video_num = get_attr(plain, "video_num")
     return __returns
Beispiel #8
0
 def _build_instance(plain: dict) -> WebBaike:
     __returns = WebBaike()
     __returns.plain = plain
     __returns.des = get_attr(plain, "des")
     for i in get_attr(plain, "labels"):
         __returns.labels.append(i)
     __returns.origin = get_attr(plain, "origin")
     __returns.poster = get_attr(plain, "poster")
     if get_attr(plain, "sections") is not None:
         for i in get_attr(plain, "sections"):
             __returns.sections.append(WebSection._build_instance(i))
     __returns.title = get_attr(plain, "title")
     __returns.url = get_attr(plain, "url")
     return __returns
Beispiel #9
0
 def _build_instance(plain: dict) -> WebShortVideoDetail:
     __returns = WebShortVideoDetail()
     __returns.plain = plain
     __returns.author = get_attr(plain, "author")
     __returns.author_avatar = get_attr(plain, "author_avatar")
     __returns.play_times = get_attr(plain, "play_times")
     __returns.poster = get_attr(plain, "poster")
     __returns.title = get_attr(plain, "title")
     __returns.url = get_attr(plain, "url")
     return __returns
Beispiel #10
0
 def _build_instance(plain: dict) -> WebNormal:
     __returns = WebNormal()
     __returns.plain = plain
     __returns.des = get_attr(plain, "des")
     __returns.image = get_attr(plain, "image")
     __returns.title = get_attr(plain, "title")
     __returns.url = get_attr(plain, "url")
     if get_attr(plain, "sections") is not None:
         for i in get_attr(plain, "sections"):
             __returns.sections.append(WebSection._build_instance(i))
     return __returns
Beispiel #11
0
 def _build_instance(plain: list, query: str = "") -> WebResult:
     __returns = WebResult()
     __returns.plain = plain
     __returns.query = query
     for p in plain:
         if get_attr(p, "type") == "result":
             __returns.normal.append(WebNormal._build_instance(p))
         elif get_attr(p, "type") == "video":
             __returns.video = WebVideo._build_instance(p)
         elif get_attr(p, "type") == "short_video":
             __returns.short_video = WebShortVideo._build_instance(p)
         elif get_attr(p, "type") == "reyi":
             __returns.reyi = WebReyi._build_instance(p)
         elif get_attr(p, "type") == "knowledge":
             __returns.knowledge = WebKnowledge._build_instance(p)
         elif get_attr(p, "type") == "baike":
             __returns.baike = WebBaike._build_instance(
                 get_attr(p, "result"))
         elif get_attr(p, "type") == "video_normal":
             __returns.video_normal.append(
                 WebVideoNormal._build_instance(p))
     return __returns
Beispiel #12
0
 def _build_instance(plain: dict) -> WebVideoTag:
     __returns = WebVideoTag()
     __returns.plain = plain
     __returns.text = get_attr(plain, "text")
     __returns.url = get_attr(plain, "url")
     return __returns
Beispiel #13
0
 def _build_instance(plain: dict) -> WebVideoNormalInfo:
     __returns = WebVideoNormalInfo()
     __returns.plain = plain
     __returns.data = get_attr(plain, "data")
     __returns.type = get_attr(plain, "type")
     return __returns
Beispiel #14
0
 def _build_instance(plain: dict) -> WebSection:
     __returns = WebSection()
     __returns.plain = plain
     __returns.text = get_attr(plain, "text")
     __returns.url = get_attr(plain, "url")
     return __returns