Contents
最近又在重新折腾 Wordpress 博客,挑选一个好用的主题是必须的步骤。从 github 和 gitee 中精选了一些主题。
页面设计、功能特性等方面每个人都不一样,我们比较一下主题的最近更新时间(是不是一直在维护)、star 人数(一定程度上反映主题使用人数和主题质量)、贡献者人数等指标。
开源优质主题列表
这些主题应该都是国内开发者制作的,支持中文,适合国情,适合国人使用。
直接上对比表格:(截止 2023.9,按最近更新时间倒序排列),建议选择 2023 年仍有更新的主题,作者一直在维护和更新。
数据抓取脚本
Selenium 用法参考 Python Selenium 从入门到精通(建议收藏)– 最美 Lily-bestoflily。
"""
selenium 要使用 3.x 版本
"""
# coding=utf-8
import json
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait as Wait
from selenium.webdriver.support import expected_conditions as Expect
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
# options.add_argument("--kiosk") # 加载启动项页面全屏效果,相当于 F11
options.add_argument('--no-sandbox') # 解决 DevToolsActivePort 文件不存在的报错
options.add_argument('--disable-gpu') # 谷歌文档提到需要加上这个属性来规避 bug
options.add_argument('lang=zh_CN')
options.add_argument('--proxy-server=127.0.0.1:7890')
options.add_argument('--headless') # 添加该参数,避免使用 windows 任务计划自动执行测试时,任务所属的用户未登录状态,否则该用户没有 desktop,会导致窗口浏览器最大化不起作用
options.add_argument('window-size=1920x1080') # 指定浏览器分辨率 等效于 driver.set_window_size(width=1920, height=1080) # 添加这个后,windows 按计划任务运行时也会打开浏览器,解决按计划自动运行任务时,浏览器截图不全问题
# options.add_argument("--disable-3d-apis")
options.add_experimental_option("excludeSwitches", ['enable-automation']) # # 开启管理者模式 #禁止谷歌弹出正在被自动化软件控制消息
options.binary_location = "/Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"
browser = webdriver.Chrome(
executable_path='/Users/raymon/soft/mac/chromedriver-mac-arm64/chromedriver',
options=options)
github_url = 'https://github.com'
proxies = {"http": "socks5://127.0.0.1:7890", "https": "socks5://127.0.0.1:7890"}
keyword = 'chaos engineering'
def get_repo_detail(repo_url):
"""
:param repo_url:
"""
browser.get(repo_url)
Wait(browser, 10).until(Expect.text_to_be_present_in_element((By.XPATH, '/html/body'), 'commits'))
repo = {}
repo['star'] = browser.find_element_by_id('repo-stars-counter-star').text
contributors = browser.find_elements_by_xpath('//div/h2/a')
try:
repo['contributor'] = \
[c.text.replace('Contributors\n', '') for c in contributors if c.text.find('Contributor') >= 0][0]
except:
repo['contributor'] = ' 未获取到数据 '
repo['commit'] = browser.find_element_by_xpath('//ul/li/a/span/strong').text
repo['last_commit_time'] = browser.find_element_by_xpath('//a[2]/relative-time').get_attribute('datetime')
return repo
def get_title(url):
try:
browser.get(url)
return browser.title
except Exception as e:
return ' 无法访问 '
# print(get_title('https://github.com/tonik/theme'))
def output_info(repo_url, demo_url):
repo = get_repo_detail(repo_url)
message = f"""| [{get_title(repo_url)}]({repo_url}) | [{get_title(demo_url)}]({demo_url}) | {repo['last_commit_time']} | {repo['star']} | {repo['contributor']} | {repo['commit']} |"""
print(message)
return message
# print(get_repo_detail('https://github.com/seatonjiang/kratos'))
if __name__ == '__main__':
subjects = [('https://github.com/ghboke/CorePressWPTheme', 'https://www.lovestu.com/'),
('https://github.com/mashirozx/Sakura', 'https://2heng.xin/'),
('https://github.com/ShawnZeng1996/Memory', 'https://shawnzeng.com/'),
('https://github.com/seatonjiang/kratos', 'https://www.nbmao.com/'),
('https://github.com/baomihuahua/boxmoe-dove-', 'https://www.boxmoe.com/'),
('https://github.com/saresam/Asky', 'https://peanoo.com/'),
('https://github.com/solstice23/argon-theme', 'https://blog.s23.moe/'),
('https://github.com/Licoy/wordpress-theme-puock', 'https://licoy.cn/'),
('https://github.com/zhuige-com/jiangqie_theme', 'https://xcx.jiangqie.com/'),
('https://github.com/syfxlin/origami', 'https://blog.ixk.me/'),
('https://github.com/censujiang/Mokore', 'https://mokore.dfjcx.cn/'),
('https://github.com/faganer/info', 'https://wpmore.cn/wordpress-theme-info.html'),
('https://github.com/Tokinx/Adams', 'https://biji.io/'),
('https://github.com/yrccondor/mdx', 'https://flyhigher.top/'),
('https://github.com/limileo/L-Talk', 'https://blog.limiabc.com/'),
('https://github.com/LoeiFy/Diaspora', 'https://isujin.com/'),
('https://github.com/yqchilde/rebirth', 'https://yqqy.top/'),
('https://github.com/bigfa/Sulli', 'https://fatesinger.com/')
]
# output_info('https://github.com/seatonjiang/kratos', 'https://www.nbmao.com/')
for r, d in subjects:
output_info(r, d)
参考来源
正文完