Skip to content

Commit

Permalink
Site updated: 2023-07-04 16:57:11
Browse files Browse the repository at this point in the history
  • Loading branch information
cxzlw committed Jul 4, 2023
1 parent 55605ea commit 3427440
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 373 deletions.
11 changes: 4 additions & 7 deletions 2023/07/04/zhihu-aac-old/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<meta name="author" content="cxzlw">
<meta name="keywords" content="">

<meta name="description" content="近些阵子知乎上线了针对专栏[1]中盐选文章的反爬系统,随后该系统也被运用在知乎回答页面中的盐选文章上,具体表现为爬取的文章内容中出现大量的错乱词汇。而在本篇文章中我们将一步步带领各位解开这些乱码,在这个过程中我们将对字体反爬有更深入的认识,并学到运用字体反爬时需要注意的问题。 一、知乎反爬效果来自知乎回答不被爱是一种什么样的感受? - 知乎 如图所示,在页面源码中出现了大量乱码,例如(原字,错">
<meta name="description" content="近些阵子知乎上线了针对专栏中盐选文章的反爬系统,随后该系统也被运用在知乎回答页面中的盐选文章上,具体表现为爬取的文章内容中出现大量的错乱词汇。而在本篇文章中我们将一步步带领各位解开这些乱码,在这个过程中我们将对字体反爬有更深入的认识,并学到运用字体反爬时需要注意的问题。">
<meta property="og:type" content="article">
<meta property="og:title" content="聊聊知乎盐选反爬 (回答页篇)">
<meta property="og:url" content="https://blog.cxzlw.top/2023/07/04/zhihu-aac-old/index.html">
<meta property="og:site_name" content="创新者.老王的博客">
<meta property="og:description" content="近些阵子知乎上线了针对专栏[1]中盐选文章的反爬系统,随后该系统也被运用在知乎回答页面中的盐选文章上,具体表现为爬取的文章内容中出现大量的错乱词汇。而在本篇文章中我们将一步步带领各位解开这些乱码,在这个过程中我们将对字体反爬有更深入的认识,并学到运用字体反爬时需要注意的问题。 一、知乎反爬效果来自知乎回答不被爱是一种什么样的感受? - 知乎 如图所示,在页面源码中出现了大量乱码,例如(原字,错">
<meta property="og:description" content="近些阵子知乎上线了针对专栏中盐选文章的反爬系统,随后该系统也被运用在知乎回答页面中的盐选文章上,具体表现为爬取的文章内容中出现大量的错乱词汇。而在本篇文章中我们将一步步带领各位解开这些乱码,在这个过程中我们将对字体反爬有更深入的认识,并学到运用字体反爬时需要注意的问题。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://blog.cxzlw.top/imgs/image.png">
<meta property="og:image" content="https://blog.cxzlw.top/imgs/image-1.png">
Expand All @@ -30,11 +30,10 @@
<meta property="og:image" content="https://blog.cxzlw.top/imgs/image-4.png">
<meta property="og:image" content="https://blog.cxzlw.top/imgs/image-5.png">
<meta property="article:published_time" content="2023-07-04T01:38:31.000Z">
<meta property="article:modified_time" content="2023-07-04T16:52:15.204Z">
<meta property="article:modified_time" content="2023-07-04T16:56:59.726Z">
<meta property="article:author" content="cxzlw">
<meta property="article:tag" content="知乎">
<meta property="article:tag" content="反爬">
<meta property="article:tag" content="失效">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://blog.cxzlw.top/imgs/image.png">

Expand Down Expand Up @@ -318,7 +317,7 @@ <h2 id="三、致命缺陷"><a href="#三、致命缺陷" class="headerlink" tit
<p>我们发现字形的 Glyph 为 uni662F 而 Unicode 为65F6,接下来我们试着查询这两个十六进制数对应的字:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs python">glyph = <span class="hljs-string">&quot;\u662F&quot;</span><br>unicode = <span class="hljs-string">&quot;\u65F6&quot;</span><br><span class="hljs-built_in">print</span>(glyph, unicode)<br><span class="hljs-comment"># output: 是 时</span><br></code></pre></td></tr></table></figure>

<p>正好,上文提到,「是」在源码中被替换为了「时」。知乎在反爬字体中保留了原字与新字的对应关系,为我们提供了一个极为便捷的捷径,避免了对字形笔画的具体分析,这也是其字体反爬系统的致命缺陷。</p>
<p>正好,上文提到,「是」在源码中被替换为了「时」。知乎在反爬字体中保留了原字与新字的对应关系,为我们提供了一个极为便捷的捷径,避免了对字形笔画的具体分析,这也是其字体反爬系统的致命缺陷,各位在自己的网站运用字体反爬时也要注意这一点</p>
<p>至此,字形的特征与对应关系都被我们分析出了,接下来我们将编写程序从字体中提取对应关系。</p>
<h2 id="四、提取对应关系"><a href="#四、提取对应关系" class="headerlink" title="四、提取对应关系"></a>四、提取对应关系</h2><p>要提取各个字间的对应关系,首先我们需要安装 fontTools <sup id="fnref:4" class="footnote-ref"><a href="#fn:4" rel="footnote"><span class="hint--top hint--rounded" aria-label="fontTools文档:[fontTools Docs — fontTools Documentation](https://fonttools.readthedocs.io/en/latest/)">[4]</span></a></sup></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">pip install fonttools<br></code></pre></td></tr></table></figure>
Expand Down Expand Up @@ -363,8 +362,6 @@ <h2 id="注"><a href="#注" class="headerlink" title="注"></a>注</h2><section

<a href="/tags/%E5%8F%8D%E7%88%AC/" class="print-no-link">#反爬</a>

<a href="/tags/%E5%A4%B1%E6%95%88/" class="print-no-link">#失效</a>

</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta property="og:description" content="欢迎来到我的博客">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-07-03T01:01:41.000Z">
<meta property="article:modified_time" content="2023-07-04T16:52:15.204Z">
<meta property="article:modified_time" content="2023-07-04T16:56:59.726Z">
<meta property="article:author" content="cxzlw">
<meta name="twitter:card" content="summary_large_image">

Expand Down
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ <h2 class="index-header">

<a class="index-excerpt index-excerpt__noimg" href="/2023/07/04/zhihu-aac-old/" target="_self">
<div>
近些阵子知乎上线了针对专栏[1]中盐选文章的反爬系统,随后该系统也被运用在知乎回答页面中的盐选文章上,具体表现为爬取的文章内容中出现大量的错乱词汇。而在本篇文章中我们将一步步带领各位解开这些乱码,在这个过程中我们将对字体反爬有更深入的认识,并学到运用字体反爬时需要注意的问题。 一、知乎反爬效果来自知乎回答不被爱是一种什么样的感受? - 知乎 如图所示,在页面源码中出现了大量乱码,例如(原字,错
近些阵子知乎上线了针对专栏中盐选文章的反爬系统,随后该系统也被运用在知乎回答页面中的盐选文章上,具体表现为爬取的文章内容中出现大量的错乱词汇。而在本篇文章中我们将一步步带领各位解开这些乱码,在这个过程中我们将对字体反爬有更深入的认识,并学到运用字体反爬时需要注意的问题。
</div>
</a>

Expand All @@ -256,8 +256,6 @@ <h2 class="index-header">

<a href="/tags/%E5%8F%8D%E7%88%AC/">#反爬</a>

<a href="/tags/%E5%A4%B1%E6%95%88/">#失效</a>

</div>

</div>
Expand Down
Loading

0 comments on commit 3427440

Please sign in to comment.