MCPcopy Create free account
hub / github.com/PyQt5/PyQt / _makeItem

Function _makeItem

QFlowLayout/testxpath.py:20–47  ·  view source on GitHub ↗
(lis)

Source from the content-addressed store, hash-verified

18
19
20def _makeItem(lis):
21 for li in lis:
22 a = li.find('.//div/a')
23 play_url = "https://music.163.com" + a.get("href") # 视频播放地址
24 img = li.find(".//div/img")
25 cover_url = img.get("src") # 封面图片
26 playlist_title = a.get("title") # 歌单名
27 # figure_info = a.find("div/span")
28 figure_info = "aaa" #if figure_info is None else figure_info.text # 影片信息
29 figure_score = "" # 评分
30 # 歌手
31 figure = li.xpath(".//p[2]/a")[0]
32 playlist_author = "<span style=\"font-size: 12px;\"作者:{}</span>".format(
33 Actor.format(href="https://music.163.com" +figure.get("href"),title=figure.get("title")))
34 # 播放数
35 play_count = (li.xpath(".//div/div/span[2]/text()") or [""])[0]
36 path = "cache/{0}.jpg".format(
37 os.path.splitext(os.path.basename(cover_url).split('?')[0])[0])
38 cover_path = "Data/pic_v.png"
39 if os.path.isfile(path):
40 cover_path = path
41
42 print(cover_path, playlist_title, playlist_author,
43 play_count, play_url, cover_url, path)
44 # iwidget = ItemWidget(cover_path, playlist_title,
45 # playlist_author, play_count, play_url,
46 # cover_url, path, self)
47 # self._layout.addWidget(iwidget)
48
49
50def _parseHtml(html):

Callers 1

_parseHtmlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected