コード例 #1
0
ファイル: avgle_com.py プロジェクト: liqiang0330/JavPy
 def search_by_code(mcs, code):
     url = "https://api.avgle.com/v1/search/" + code + "/0?limit=1"
     rsp = json.loads(requests.get(url, proxies=proxy).text)
     av = AV()
     av.title = rsp["response"]["videos"][0]["title"]
     av.video_url = rsp["response"]["videos"][0]["video_url"]
     av.code = code
     av.preview_img_url = rsp["response"]["videos"][0]["preview_url"]
     return av
コード例 #2
0
 def search_by_code(cls, code):
     url = "https://api.avgle.com/v1/search/" + code + "/0?limit=1"
     rsp = json.loads(requests.get(url).text)
     av = AV()
     av.title = rsp['response']['videos'][0]['title']
     av.video_url = rsp['response']['videos'][0]['video_url']
     av.code = code
     av.preview_img_url = rsp['response']['videos'][0]['preview_url']
     return av
コード例 #3
0
 def parse_major_info(rsp):
     items = re.findall("<div class=\"video\".+?</div></div>", rsp.text, re.S)
     res = []
     for item in items:
         av = AV()
         img_url = re.search("<img src=\"(.+?)\"", item).group(1).replace("ps.jpg", "pl.jpg")
         if not img_url.startswith("http"):
             img_url = "http:" + img_url
         av.preview_img_url = img_url
         av.code = re.search("<div class=\"id\">(.+?)</div>", item).group(1)
         av.title = re.search("<div class=\"title\" >(.+?)</div>", item).group(1)
         res.append(av)
     return res