使用Python处理Markdown front matter

什么是 Front matter

在你使用Hexo等基于Markdown的静态博客生成系统时,工具为你所生成的 md 文件开头通常会有一个符合YAML语法的代码段

比如我现在正在写的这篇文章,它的开头是这样的:

1
2
3
4
5
6
7
---
title: 使用Python处理Markdown front matter
toc: true
date: 2022-05-21 20:38:07
tags:
- Python
---

这就是 Front matter,它可以为 Markdown 文件提供一些基本的信息

Read more

Scrapy deepcopy

Why write this post

The code:

1
2
3
4
5
6
7
8
9
10
11
12
def parse_category(self, response):
flower = FlowerItem()
root = response.css("div.zhiwuImg")
for li in root.css("li"):
flower["name"] = li.css("img").attrib['title']
yield scrapy.Request(url=self.webroot+li.css("a:first-child::attr(href)").get(), meta={"item":flower}, callback=self.parse_detail)

def parse_detail(self, response):
flower = response.meta['item']
root = response.css("div.contentDiv")
flower['firstletter'] = root.css("blockquote p::text").get()
yield flower
Read more

LeagueClient通信(0)-LCU通讯原理&如何让熊孩子玩不了LOL

缘起

之前看到 @MarioCrane 的自定义创建 5V5 训练模式工具,让我对 LOL 客户端的 API 又产生了点兴趣。

仓库地址: https://github.com/MarioCrane/LeaueLobby

为啥要说又。。因为之前对 LOL 的 wad 资源拆包的时候我曾了解过 LeagueClient 的一些运行原理

Riot 的开发者博客曾经在更新客户端的时候解析了其中的技术原理

https://technology.riotgames.com/news/architecture-league-client-update

相比之前的了解,目前 Riot 的开发文档已经完善了很多,值得去探索一番。

Read more

理解Python中的Decorator

前言

之前看廖雪峰老师的 Python 教程的时候卡在装饰器那一节,干脆跳了过去。

现在看到@property的使用,又涉及到了装饰器的相关知识,于是只好回头来好好学一下了。。。

在了解装饰器之前,建议先了解一下什么是闭包

Read more
Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×