爬取github上流行的python項目
阿新 • • 發佈:2017-11-26
fin .get get cnblogs rep 地址 ges name req
# -*- coding:utf-8 -*- __author__ = "MuT6 Sch01aR" import requests from pyquery import PyQuery def GetGitHub(): url = "https://github.com/trending/python" r = requests.get(url) for i in PyQuery(r.content)(".repo-list>li"): repo_url = "https://github.com"+PyQuery(i).find(".mb-1 a").attr("href") name = PyQuery(i).find(".mb-1 a").text() star = PyQuery(i).find("a.mr-3").text() print("項目:"+name,"星星數:"+star,"項目地址:"+repo_url) GetGitHub()
運行結果
爬取github上流行的python項目