手拉手定制GitHub个人首页
白日不到处,青春恰自来。
苔花如米小,也学牡丹开。

前情提要
GitHub 最近被收购之后变得异常活跃各种优化不断
- 基于python爬些自己想要的数据
- 拥有自己的Action开启定时任务
- 以自己命名的特殊库会展示到个人首页
 xkloveme/xkloveme is a special repository. ItsREADME.mdwill appear on your public profile!
实施
方案清晰后可以,着手开发
md文件支持图片和svg,首页每日自动替换bing图片
新建GitHub同名库
当新建一个同名库的时候README.md文件内容会展示到个人首页
使用徽章
- shields.io/的徽章
 GitHub徽标的官方网站是 shields.io/,我萌可以在官网预览绝大部分的徽标样式,然后选择自己喜欢的(当然首先需要适用于自己的目标项目)徽标,添加到自己的项目文档中去
  
- forthebadge.com/的徽章
  
- 项目的徽章
  
每日图片爬虫
- 人生苦短我用python
- 基于python3,爬https://cn.bing.com/- 的背景图
| import bs4import tools
 from bs4 import BeautifulSoup
 
 | 
| def getSource(self):img = ''
 url = 'https://cn.bing.com'
 req = [
 'user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Mobile Safari/537.36',
 ]
 res = self.T.getPage(url, req)
 if res['code'] == 200:
 soup = BeautifulSoup(res['body'], 'html.parser')
 img = url + soup.find(id='sh_url').get('value')
 return img
 
 | 
| if __name__ == '__main__':obj = Source()
 img = '[ + ')](https://www.jixiaokang.com)'
 readme = root / "README.md"
 readme_contents = open(readme, 'w')
 md = "\n".join(
 [
 '[](https://www.jixiaokang.com)',
 '[](https://www.jixiaokang.com)  '
 '[](https://www.jixiaokang.com)  '
 '[](https://www.jixiaokang.com)',
 '[](https://www.jixiaokang.com)',
 "# 每日壁纸",
 img,
 '# 推荐链接🔗',
 '> [项目说明](https://github.com/xkloveme/xkloveme/blob/master/PROJECT.md)如果想展示您的主页🔗请`pr`,如有喜欢请关注\n',
 ]
 )
 link = root / "LINK.md"
 link_contents = open(link, 'r')
 link_list = link_contents.readlines()
 readme_contents.write(md)
 readme_contents.writelines(link_list)
 readme_contents.close()
 
 | 
- 配置CI,这里选用官方Action,速度快稳定性高,配置简单
| SIMONW_TOKEN:  ${{ secrets.SIMONW_TOKEN }} // 为了自动推送到库
 | 
| - name: Install Python dependenciesrun: |
 python -m pip install -r requirements.txt
 - name: Update README
 env:
 SIMONW_TOKEN: ${{ secrets.SIMONW_TOKEN }}
 run: |-
 python main.py
 cat README.md
 - name: Commit and push if changed
 run: |-
 git diff
 git config --global user.email "readme-bot@example.com"
 git config --global user.name "README-bot"
 git add -A
 git commit -m "AUTO:👷♀️Updated content" || exit 0
 git push
 
 | 
| schedule:-  cron:  '32 * * * *'
 
 | 
大功告成

参与进来
如果您也喜欢折腾的话,我在这里发起一个项目,以便展示您个人主页.
希望您可以fork此项目
| git clone https://github.com/xkloveme/xkloveme.git --depth 1
 | 
定制您个人想要的主页
pr到LINK.md,格式如下:
- [xkloveme 的主页](https://github.com/xkloveme)
各位姥爷请放心,每小时同步一次数据
项目地址