| 1 |
# SOME DESCRIPTIVE TITLE. |
| 2 |
# Copyright (C) Kovid Goyal |
| 3 |
# This file is distributed under the same license as the calibre package. |
| 4 |
# |
| 5 |
# Translators: |
| 6 |
# DWXXX, 2015 |
| 7 |
# Kevin Jin <[email protected]>, 2016 |
| 8 |
# Lily Wang, 2022 |
| 9 |
# RERBIN MA, 2026 |
| 10 |
# tony shen <[email protected]>, 2024 |
| 11 |
# vicentory <[email protected]>, 2018 |
| 12 |
msgid "" |
| 13 |
msgstr "" |
| 14 |
"Project-Id-Version: calibre\n" |
| 15 |
"Report-Msgid-Bugs-To: \n" |
| 16 |
"POT-Creation-Date: 2026-03-12 02:31+0000\n" |
| 17 |
"PO-Revision-Date: 2014-06-17 08:34+0000\n" |
| 18 |
"Last-Translator: RERBIN MA, 2026\n" |
| 19 |
"Language-Team: Chinese (China) (http://app.transifex.com/calibre/calibre/language/zh_CN/)\n" |
| 20 |
"MIME-Version: 1.0\n" |
| 21 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 22 |
"Content-Transfer-Encoding: 8bit\n" |
| 23 |
"Language: zh_CN\n" |
| 24 |
"Plural-Forms: nplurals=1; plural=0;\n" |
| 25 |
|
| 26 |
#: ../../../__w/calibre/calibre/manual/news.rst:4 |
| 27 |
msgid "Adding your favorite news website" |
| 28 |
msgstr "添加你喜欢的新闻站点" |
| 29 |
|
| 30 |
#: ../../../__w/calibre/calibre/manual/news.rst:6 |
| 31 |
msgid "" |
| 32 |
"calibre has a powerful, flexible and easy-to-use framework for downloading " |
| 33 |
"news from the Internet and converting it into an e-book. The following will " |
| 34 |
"show you, by means of examples, how to get news from various websites." |
| 35 |
msgstr "caliber有一个强大,灵活且易于使用的框架,用于从Internet下载新闻并将其转换为电子书。 以下将通过示例向您展示如何从各种网站获取新闻。" |
| 36 |
|
| 37 |
#: ../../../__w/calibre/calibre/manual/news.rst:8 |
| 38 |
msgid "" |
| 39 |
"To gain an understanding of how to use the framework, follow the examples in" |
| 40 |
" the order listed below:" |
| 41 |
msgstr "要了解如何使用框架,请按照下面列出的顺序执行示例:" |
| 42 |
|
| 43 |
#: ../../../__w/calibre/calibre/manual/news.rst:15 |
| 44 |
msgid "Completely automatic fetching" |
| 45 |
msgstr "完全自动获取" |
| 46 |
|
| 47 |
#: ../../../__w/calibre/calibre/manual/news.rst:17 |
| 48 |
msgid "" |
| 49 |
"If your news source is simple enough, calibre may well be able to fetch it " |
| 50 |
"completely automatically, all you need to do is provide the URL. calibre " |
| 51 |
"gathers all the information needed to download a news source into a " |
| 52 |
":term:`recipe`. In order to tell calibre about a news source, you have to " |
| 53 |
"create a :term:`recipe` for it. Let's see some examples:" |
| 54 |
msgstr "如果你的新闻来源足够简单,Calibre很可能能够完全自动获取它,你所需要做的就是提供URL。Calibre收集下载新闻源到`Receipe`所需的所有信息。为了告诉Calibre关于一个新闻源的信息,你必须为它创建一个“Receipe”。让我们来看一些例子:" |
| 55 |
|
| 56 |
#: ../../../__w/calibre/calibre/manual/news.rst:26 |
| 57 |
msgid "The calibre blog" |
| 58 |
msgstr "calibre博客" |
| 59 |
|
| 60 |
#: ../../../__w/calibre/calibre/manual/news.rst:28 |
| 61 |
msgid "" |
| 62 |
"The calibre blog is a blog of posts that describe many useful calibre " |
| 63 |
"features in a simple and accessible way for new calibre users. In order to " |
| 64 |
"download this blog into an e-book, we rely on the :term:`RSS` feed of the " |
| 65 |
"blog::" |
| 66 |
msgstr "calibre 博客是一个帖子博客,以简单易懂的方式为新 calibre 用户描述许多有用的 calibre 功能。 为了将此博客下载成电子书,我们依赖博客的“RSS”提要:" |
| 67 |
|
| 68 |
#: ../../../__w/calibre/calibre/manual/news.rst:34 |
| 69 |
msgid "" |
| 70 |
"I got the RSS URL by looking under \"Subscribe to\" at the bottom of the " |
| 71 |
"blog page and choosing :guilabel:`Posts->Atom`. To make calibre download the" |
| 72 |
" feeds and convert them into an e-book, you should right click the " |
| 73 |
":guilabel:`Fetch news` button and then the :guilabel:`Add a custom news " |
| 74 |
"source` menu item and then the :guilabel:`New Recipe` button. A dialog " |
| 75 |
"similar to that shown below should open up." |
| 76 |
msgstr "我通过查看博客页面底部的“订阅”并选择“Posts->Atom”获得了 RSS URL。 要使 calibre 下载提要并将其转换为电子书,您应该右键单击“获取新闻”按钮,然后单击“添加自定义新闻源”菜单项,然后单击“新新闻源”按钮。 应该会打开一个类似于下图所示的对话框。" |
| 77 |
|
| 78 |
#: ../../../__w/calibre/calibre/manual/news.rst:43 |
| 79 |
msgid "" |
| 80 |
"First enter ``Calibre Blog`` into the :guilabel:`Recipe title` field. This " |
| 81 |
"will be the title of the e-book that will be created from the articles in " |
| 82 |
"the above feeds." |
| 83 |
msgstr "首先在“新闻源标题”字段中输入“Calibre Blog”。 这将是根据上述提要中的文章创建的电子书的标题。" |
| 84 |
|
| 85 |
#: ../../../__w/calibre/calibre/manual/news.rst:45 |
| 86 |
msgid "" |
| 87 |
"The next two fields (:guilabel:`Oldest article` and :guilabel:`Max. number " |
| 88 |
"of articles`) allow you some control over how many articles should be " |
| 89 |
"downloaded from each feed, and they are pretty self explanatory." |
| 90 |
msgstr "接下来的两个字段(“最旧的文章”和“最大文章数”)允许您控制应该从每个提要下载多少文章,并且它们非常不言自明。" |
| 91 |
|
| 92 |
#: ../../../__w/calibre/calibre/manual/news.rst:47 |
| 93 |
msgid "" |
| 94 |
"To add the feeds to the recipe, enter the feed title and the feed URL and " |
| 95 |
"click the :guilabel:`Add feed` button. Once you have added the feed, simply " |
| 96 |
"click the :guilabel:`Save` button and you're done! Close the dialog." |
| 97 |
msgstr "要将提要添加到新闻源中,请输入提要标题和提要 URL,然后单击“添加提要”按钮。 添加提要后,只需单击“保存”按钮即可完成! 关闭对话框。" |
| 98 |
|
| 99 |
#: ../../../__w/calibre/calibre/manual/news.rst:51 |
| 100 |
msgid "" |
| 101 |
"To test your new :term:`recipe`, click the :guilabel:`Fetch news` button and" |
| 102 |
" in the :guilabel:`Custom news sources` sub-menu click :guilabel:`calibre " |
| 103 |
"Blog`. After a couple of minutes, the newly downloaded e-book of blog posts " |
| 104 |
"will appear in the main library view (if you have your reader connected, it " |
| 105 |
"will be put onto the reader instead of into the library). Select it and hit " |
| 106 |
"the :guilabel:`View` button to read!" |
| 107 |
msgstr "要测试新的“新闻源”,请单击“获取新闻”按钮,然后在“自定义新闻源”子菜单中单击“calibre Blog”。 几分钟后,新下载的博客文章电子书将出现在主书库视图中(如果您连接了阅读器,它将被放入阅读器而不是书库中)。 选择它并点击“查看”按钮即可阅读!" |
| 108 |
|
| 109 |
#: ../../../__w/calibre/calibre/manual/news.rst:53 |
| 110 |
msgid "" |
| 111 |
"The reason this worked so well, with so little effort is that the blog " |
| 112 |
"provides *full-content* :term:`RSS` feeds, i.e., the article content is " |
| 113 |
"embedded in the feed itself. For most news sources that provide news in this" |
| 114 |
" fashion, with *full-content* feeds, you don't need any more effort to " |
| 115 |
"convert them to e-books. Now we will look at a news source that does not " |
| 116 |
"provide full content feeds. In such feeds, the full article is a webpage and" |
| 117 |
" the feed only contains a link to the webpage with a short summary of the " |
| 118 |
"article." |
| 119 |
msgstr "这种方法效果如此之好、花费如此之少的原因是博客提供了“完整内容”“RSS”提要,即文章内容嵌入在提要本身中。 对于大多数以这种方式提供新闻的新闻源,通过“完整内容”提要,您不需要更多的努力将它们转换为电子书。 现在我们将看看不提供完整内容提要的新闻源。 在此类提要中,完整的文章是一个网页,并且提要仅包含指向该网页的链接以及文章的简短摘要。" |
| 120 |
|
| 121 |
#: ../../../__w/calibre/calibre/manual/news.rst:58 |
| 122 |
msgid "bbc.co.uk" |
| 123 |
msgstr "bbc.co.uk" |
| 124 |
|
| 125 |
#: ../../../__w/calibre/calibre/manual/news.rst:60 |
| 126 |
msgid "Let's try the following two feeds from *The BBC*:" |
| 127 |
msgstr "让我们尝试一下来自 *The BBC* 的以下两个提要:" |
| 128 |
|
| 129 |
#: ../../../__w/calibre/calibre/manual/news.rst:62 |
| 130 |
msgid "" |
| 131 |
"News Front Page: " |
| 132 |
"https://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml" |
| 133 |
msgstr "新闻头版:https://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml" |
| 134 |
|
| 135 |
#: ../../../__w/calibre/calibre/manual/news.rst:63 |
| 136 |
msgid "" |
| 137 |
"Science/Nature: " |
| 138 |
"https://newsrss.bbc.co.uk/rss/newsonline_world_edition/science/nature/rss.xml" |
| 139 |
msgstr "科学/自然:https://newsrss.bbc.co.uk/rss/newsonline_world_edition/science/nature/rss.xml" |
| 140 |
|
| 141 |
#: ../../../__w/calibre/calibre/manual/news.rst:65 |
| 142 |
msgid "" |
| 143 |
"Follow the procedure outlined in :ref:`calibre_blog` above to create a " |
| 144 |
"recipe for *The BBC* (using the feeds above). Looking at the downloaded " |
| 145 |
"e-book, we see that calibre has done a creditable job of extracting only the" |
| 146 |
" content you care about from each article's webpage. However, the extraction" |
| 147 |
" process is not perfect. Sometimes it leaves in undesirable content like " |
| 148 |
"menus and navigation aids or it removes content that should have been left " |
| 149 |
"alone, like article headings. In order, to have perfect content extraction, " |
| 150 |
"we will need to customize the fetch process, as described in the next " |
| 151 |
"section." |
| 152 |
msgstr "按照上面“calibre_blog”中概述的过程为 *The BBC* 创建新闻源(使用上面的提要)。 查看下载的电子书,我们发现 calibre 做得工作非常出色,它只从每篇文章的网页中提取您关心的内容。 然而,提取过程并不完美。 有时,它会留下不需要的内容,例如菜单和导航辅助工具,或者删除本应保留的内容,例如文章标题。 为了实现完美的内容提取,我们需要自定义获取过程,如下一节所述。" |
| 153 |
|
| 154 |
#: ../../../__w/calibre/calibre/manual/news.rst:68 |
| 155 |
msgid "Customizing the fetch process" |
| 156 |
msgstr "自定义获取过程" |
| 157 |
|
| 158 |
#: ../../../__w/calibre/calibre/manual/news.rst:70 |
| 159 |
msgid "" |
| 160 |
"When you want to perfect the download process, or download content from a " |
| 161 |
"particularly complex website, you can avail yourself of all the power and " |
| 162 |
"flexibility of the :term:`recipe` framework. In order to do that, in the " |
| 163 |
":guilabel:`Add custom news sources` dialog, simply click the " |
| 164 |
":guilabel:`Switch to Advanced mode` button." |
| 165 |
msgstr "当您想要完善下载过程或从特别复杂的网站下载内容时,您可以利用“recipe”框架的所有功能和灵活性。 为此,在“添加自定义新闻源”对话框中,只需单击“切换到高级模式”按钮即可。" |
| 166 |
|
| 167 |
#: ../../../__w/calibre/calibre/manual/news.rst:72 |
| 168 |
msgid "" |
| 169 |
"The easiest and often most productive customization is to use the print " |
| 170 |
"version of the online articles. The print version typically has much less " |
| 171 |
"cruft and translates much more smoothly to an e-book. Let's try to use the " |
| 172 |
"print version of the articles from *The BBC*." |
| 173 |
msgstr "最简单且通常最有效的定制是使用在线文章的印刷版。 印刷版通常没有那么繁琐,并且可以更顺利地转换为电子书。 让我们尝试使用 *The BBC* 文章的印刷版。" |
| 174 |
|
| 175 |
#: ../../../__w/calibre/calibre/manual/news.rst:75 |
| 176 |
msgid "Using the print version of bbc.co.uk" |
| 177 |
msgstr "使用 bbc.co.uk 的印刷版" |
| 178 |
|
| 179 |
#: ../../../__w/calibre/calibre/manual/news.rst:77 |
| 180 |
msgid "" |
| 181 |
"The first step is to look at the e-book we downloaded previously from " |
| 182 |
":ref:`bbc`. At the end of each article, in the e-book is a little blurb " |
| 183 |
"telling you where the article was downloaded from. Copy and paste that URL " |
| 184 |
"into a browser. Now on the article webpage look for a link that points to " |
| 185 |
"the \"Printable version\". Click it to see the print version of the article." |
| 186 |
" It looks much neater! Now compare the two URLs. For me they were:" |
| 187 |
msgstr "第一步是查看我们之前从“bbc”下载的电子书。 在电子书中每篇文章的末尾都有一个小简介,告诉您该文章是从哪里下载的。 将该 URL 复制并粘贴到浏览器中。 现在,在文章网页上查找指向“可打印版本”的链接。 单击它可查看文章的打印版本。 看起来整洁多了! 现在比较两个 URL。 对我来说,他们是:" |
| 188 |
|
| 189 |
#: ../../../__w/calibre/calibre/manual/news.rst:79 |
| 190 |
msgid "Article URL" |
| 191 |
msgstr "文章 URL" |
| 192 |
|
| 193 |
#: ../../../__w/calibre/calibre/manual/news.rst:80 |
| 194 |
msgid "https://news.bbc.co.uk/2/hi/science/nature/7312016.stm" |
| 195 |
msgstr "https://news.bbc.co.uk/2/hi/science/nature/7312016.stm" |
| 196 |
|
| 197 |
#: ../../../__w/calibre/calibre/manual/news.rst:82 |
| 198 |
msgid "Print version URL" |
| 199 |
msgstr "打印版 URL" |
| 200 |
|
| 201 |
#: ../../../__w/calibre/calibre/manual/news.rst:83 |
| 202 |
msgid "" |
| 203 |
"https://newsvote.bbc.co.uk/mpapps/pagetools/print/news.bbc.co.uk/2/hi/science/nature/7312016.stm" |
| 204 |
msgstr "https://newsvote.bbc.co.uk/mpapps/pagetools/print/news.bbc.co.uk/2/hi/science/nature/7312016.stm" |
| 205 |
|
| 206 |
#: ../../../__w/calibre/calibre/manual/news.rst:85 |
| 207 |
msgid "" |
| 208 |
"So it looks like to get the print version, we need to prefix every article " |
| 209 |
"URL with:" |
| 210 |
msgstr "所以看起来要获取打印版本,我们需要在每篇文章的 URL 前加上以下前缀:" |
| 211 |
|
| 212 |
#: ../../../__w/calibre/calibre/manual/news.rst:87 |
| 213 |
msgid "newsvote.bbc.co.uk/mpapps/pagetools/print/" |
| 214 |
msgstr "newsvote.bbc.co.uk/mpapps/pagetools/print/" |
| 215 |
|
| 216 |
#: ../../../__w/calibre/calibre/manual/news.rst:89 |
| 217 |
msgid "" |
| 218 |
"Now in the :guilabel:`Advanced mode` of the Custom news sources dialog, you " |
| 219 |
"should see something like (remember to select *The BBC* recipe before " |
| 220 |
"switching to advanced mode):" |
| 221 |
msgstr "现在,在“自定义新闻源”对话框的“高级模式”中,您应该看到类似的内容(请记住在切换到高级模式之前选择 *The BBC* 菜谱):" |
| 222 |
|
| 223 |
#: ../../../__w/calibre/calibre/manual/news.rst:94 |
| 224 |
msgid "" |
| 225 |
"You can see that the fields from the :guilabel:`Basic mode` have been " |
| 226 |
"translated to Python code in a straightforward manner. We need to add " |
| 227 |
"instructions to this recipe to use the print version of the articles. All " |
| 228 |
"that's needed is to add the following two lines:" |
| 229 |
msgstr "您可以看到“基本模式”中的字段已以简单的方式转换为 Python 代码。 我们需要向此新闻源添加说明以使用文章的打印版本。 所需要做的就是添加以下两行:" |
| 230 |
|
| 231 |
#: ../../../__w/calibre/calibre/manual/news.rst:101 |
| 232 |
msgid "" |
| 233 |
"This is Python, so indentation is important. After you've added the lines, " |
| 234 |
"it should look like:" |
| 235 |
msgstr "这是Python,所以缩进很重要。 添加这些行后,它应该如下所示:" |
| 236 |
|
| 237 |
#: ../../../__w/calibre/calibre/manual/news.rst:106 |
| 238 |
msgid "" |
| 239 |
"In the above, ``def print_version(self, url)`` defines a *method* that is " |
| 240 |
"called by calibre for every article. ``url`` is the URL of the original " |
| 241 |
"article. What ``print_version`` does is take that url and replace it with " |
| 242 |
"the new URL that points to the print version of the article. To learn about " |
| 243 |
"`Python <https://www.python.org>`_ see the `tutorial " |
| 244 |
"<https://docs.python.org/tutorial/>`_." |
| 245 |
msgstr "在上面,“def print_version(self, url)”定义了一个由 calibre 为每篇文章调用的*方法*。 ``url`` 是原始文章的 URL。 print_version 的作用是获取该 url 并将其替换为指向文章打印版本的新 URL。 要了解“Python <https://www.python.org>”_,请参阅“教程 <https://docs.python.org/tutorial/>”_。" |
| 246 |
|
| 247 |
#: ../../../__w/calibre/calibre/manual/news.rst:108 |
| 248 |
msgid "" |
| 249 |
"Now, click the :guilabel:`Add/update recipe` button and your changes will be" |
| 250 |
" saved. Re-download the e-book. You should have a much improved e-book. One " |
| 251 |
"of the problems with the new version is that the fonts on the print version " |
| 252 |
"webpage are too small. This is automatically fixed when converting to an " |
| 253 |
"e-book, but even after the fixing process, the font size of the menus and " |
| 254 |
"navigation bar become too large relative to the article text. To fix this, " |
| 255 |
"we will do some more customization, in the next section." |
| 256 |
msgstr "现在,单击“添加/更新新闻源”按钮,您的更改将被保存。 重新下载电子书。 你应该有一本改进了很多的电子书。 新版本的问题之一是印刷版网页上的字体太小。 当转换为电子书时,此问题会自动修复,但即使在修复过程之后,菜单和导航栏的字体大小相对于文章文本也变得太大。 为了解决这个问题,我们将在下一节中进行更多自定义。" |
| 257 |
|
| 258 |
#: ../../../__w/calibre/calibre/manual/news.rst:111 |
| 259 |
msgid "Replacing article styles" |
| 260 |
msgstr "替换文章样式" |
| 261 |
|
| 262 |
#: ../../../__w/calibre/calibre/manual/news.rst:113 |
| 263 |
msgid "" |
| 264 |
"In the previous section, we saw that the font size for articles from the " |
| 265 |
"print version of *The BBC* was too small. In most websites, *The BBC* " |
| 266 |
"included, this font size is set by means of :term:`CSS` stylesheets. We can " |
| 267 |
"disable the fetching of such stylesheets by adding the line::" |
| 268 |
msgstr "在上一节中,我们看到 *The BBC* 印刷版文章的字体太小。 在大多数网站包括 *BBC* 中,此字体大小是通过“CSS”样式表设置的。 我们可以通过添加以下行来禁用此类样式表的获取:" |
| 269 |
|
| 270 |
#: ../../../__w/calibre/calibre/manual/news.rst:119 |
| 271 |
msgid "The recipe now looks like:" |
| 272 |
msgstr "新闻源现在看起来像:" |
| 273 |
|
| 274 |
#: ../../../__w/calibre/calibre/manual/news.rst:124 |
| 275 |
msgid "" |
| 276 |
"The new version looks pretty good. If you're a perfectionist, you'll want to" |
| 277 |
" read the next section, which deals with actually modifying the downloaded " |
| 278 |
"content." |
| 279 |
msgstr "新版本看起来还不错。 如果您是完美主义者,您将需要阅读下一节,其中涉及实际修改下载的内容。" |
| 280 |
|
| 281 |
#: ../../../__w/calibre/calibre/manual/news.rst:127 |
| 282 |
msgid "Slicing and dicing" |
| 283 |
msgstr "数据交叉分析" |
| 284 |
|
| 285 |
#: ../../../__w/calibre/calibre/manual/news.rst:129 |
| 286 |
msgid "" |
| 287 |
"calibre contains very powerful and flexible abilities when it comes to " |
| 288 |
"manipulating downloaded content. To show off a couple of these, let's look " |
| 289 |
"at our old friend the :ref:`The BBC <bbc1>` recipe again. Looking at the " |
| 290 |
"source code (:term:`HTML`) of a couple of articles (print version), we see " |
| 291 |
"that they have a footer that contains no useful information, contained in" |
| 292 |
msgstr "在操作下载内容方面,calibre 包含非常强大且灵活的功能。 为了展示其中的一些,让我们再次看看我们的老朋友“BBC <bbc1>”新闻源。 查看几篇文章(打印版)的源代码(“HTML”),我们看到它们的页脚不包含任何有用的信息,包含在" |
| 293 |
|
| 294 |
#: ../../../__w/calibre/calibre/manual/news.rst:137 |
| 295 |
msgid "This can be removed by adding::" |
| 296 |
msgstr "可以通过添加以下内容来删除它:" |
| 297 |
|
| 298 |
#: ../../../__w/calibre/calibre/manual/news.rst:141 |
| 299 |
msgid "" |
| 300 |
"to the recipe. Finally, let's replace some of the :term:`CSS` that we " |
| 301 |
"disabled earlier, with our own :term:`CSS` that is suitable for conversion " |
| 302 |
"to an e-book::" |
| 303 |
msgstr "对新闻源。 最后,让我们用我们自己的适合转换为电子书的“CSS”替换我们之前禁用的一些“CSS”:" |
| 304 |
|
| 305 |
#: ../../../__w/calibre/calibre/manual/news.rst:145 |
| 306 |
msgid "With these additions, our recipe has become \"production quality\"." |
| 307 |
msgstr "通过这些添加,我们的配方已成为“生产质量”。" |
| 308 |
|
| 309 |
#: ../../../__w/calibre/calibre/manual/news.rst:147 |
| 310 |
msgid "" |
| 311 |
"This :term:`recipe` explores only the tip of the iceberg when it comes to " |
| 312 |
"the power of calibre. To explore more of the abilities of calibre we'll " |
| 313 |
"examine a more complex real life example in the next section." |
| 314 |
msgstr "当谈到calibre的能力时,这个“秘诀”只探索了冰山一角。 为了探索 calibre 的更多功能,我们将在下一节中研究一个更复杂的现实生活示例。" |
| 315 |
|
| 316 |
#: ../../../__w/calibre/calibre/manual/news.rst:150 |
| 317 |
msgid "Real life example" |
| 318 |
msgstr "现实生活中的例子" |
| 319 |
|
| 320 |
#: ../../../__w/calibre/calibre/manual/news.rst:152 |
| 321 |
msgid "" |
| 322 |
"A reasonably complex real life example that exposes more of the :term:`API` " |
| 323 |
"of ``BasicNewsRecipe`` is the :term:`recipe` for *The New York Times*" |
| 324 |
msgstr "一个相当复杂的现实生活示例,公开了“BasicNewsRecipe”的更多“API”,是“纽约时报”的“recipe”" |
| 325 |
|
| 326 |
#: ../../../__w/calibre/calibre/manual/news.rst:238 |
| 327 |
msgid "We see several new features in this :term:`recipe`. First, we have::" |
| 328 |
msgstr "我们在这个“新闻源”中看到了几个新功能。 首先,我们有:" |
| 329 |
|
| 330 |
#: ../../../__w/calibre/calibre/manual/news.rst:242 |
| 331 |
msgid "" |
| 332 |
"This sets the displayed time on the front page of the created e-book to be " |
| 333 |
"in the format, ``Day, Day_Number Month, Year``. See :attr:`timefmt " |
| 334 |
"<calibre.web.feeds.news.BasicNewsRecipe.timefmt>`." |
| 335 |
msgstr "这会将创建的电子书首页上的显示时间设置为“日,日_数字月,年”格式。 请参阅“timefmt <calibre.web.feeds.news.BasicNewsRecipe.timefmt>”。" |
| 336 |
|
| 337 |
#: ../../../__w/calibre/calibre/manual/news.rst:245 |
| 338 |
msgid "" |
| 339 |
"Then we see a group of directives to cleanup the downloaded :term:`HTML`::" |
| 340 |
msgstr "然后我们看到一组指令来清理下载的“HTML”:" |
| 341 |
|
| 342 |
#: ../../../__w/calibre/calibre/manual/news.rst:251 |
| 343 |
msgid "" |
| 344 |
"These remove everything before the first ``<h1>`` tag and everything after " |
| 345 |
"the first tag whose id is ``footer``. See :attr:`remove_tags " |
| 346 |
"<calibre.web.feeds.news.BasicNewsRecipe.remove_tags>`, " |
| 347 |
":attr:`remove_tags_before " |
| 348 |
"<calibre.web.feeds.news.BasicNewsRecipe.remove_tags_before>`, " |
| 349 |
":attr:`remove_tags_after " |
| 350 |
"<calibre.web.feeds.news.BasicNewsRecipe.remove_tags_after>`." |
| 351 |
msgstr "这些会删除第一个“<h1>”标签之前的所有内容以及第一个 id 为“footer”的标签之后的所有内容。 请参阅 `remove_tags <calibre.web.feeds.news.BasicNewsRecipe.remove_tags>`、`remove_tags_before <calibre.web.feeds.news.BasicNewsRecipe.remove_tags_before>`、`remove_tags_after <calibre.web.feeds.news.BasicNewsRecipe.remove_tags_after> `。" |
| 352 |
|
| 353 |
#: ../../../__w/calibre/calibre/manual/news.rst:253 |
| 354 |
msgid "The next interesting feature is::" |
| 355 |
msgstr "下一个有趣的功能是:" |
| 356 |
|
| 357 |
#: ../../../__w/calibre/calibre/manual/news.rst:260 |
| 358 |
msgid "" |
| 359 |
"``needs_subscription = True`` tells calibre that this recipe needs a " |
| 360 |
"username and password in order to access the content. This causes, calibre " |
| 361 |
"to ask for a username and password whenever you try to use this recipe. The " |
| 362 |
"code in :meth:`calibre.web.feeds.news.BasicNewsRecipe.get_browser` actually " |
| 363 |
"does the login into the NYT website. Once logged in, calibre will use the " |
| 364 |
"same, logged in, browser instance to fetch all content. See `mechanize " |
| 365 |
"<https://mechanize.readthedocs.io/en/latest/>`_ to understand the code in " |
| 366 |
"``get_browser``." |
| 367 |
msgstr "``needs_subscription = True`` 告诉 calibre 该菜谱需要用户名和密码才能访问内容。 这会导致每当您尝试使用此配方时,calibre 都会要求输入用户名和密码。`calibre.web.feeds.news.BasicNewsRecipe.get_browser` 中的代码实际上登录了《纽约时报》网站。 登录后,calibre 将使用相同的已登录浏览器实例来获取所有内容。 请参阅 `mechanize <https://mechanize.readthedocs.io/en/latest/>`_ 以了解 `get_browser` 中的代码。" |
| 368 |
|
| 369 |
#: ../../../__w/calibre/calibre/manual/news.rst:262 |
| 370 |
msgid "" |
| 371 |
"The next new feature is the " |
| 372 |
":meth:`calibre.web.feeds.news.BasicNewsRecipe.parse_index` method. Its job " |
| 373 |
"is to go to https://www.nytimes.com/pages/todayspaper/index.html and fetch " |
| 374 |
"the list of articles that appear in *today's* paper. While more complex than" |
| 375 |
" simply using :term:`RSS`, the recipe creates an e-book that corresponds " |
| 376 |
"very closely to the day's paper. ``parse_index`` makes heavy use of " |
| 377 |
"`BeautifulSoup <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_ to" |
| 378 |
" parse the daily paper webpage. You can also use other, more modern parsers " |
| 379 |
"if you dislike BeautifulSoup. calibre comes with `lxml <https://lxml.de/>`_ " |
| 380 |
"and `html5lib <https://github.com/html5lib/html5lib-python>`_, which are the" |
| 381 |
" recommended parsers. To use them, replace the call to ``index_to_soup()`` " |
| 382 |
"with the following::" |
| 383 |
msgstr "下一个新功能是“calibre.web.feeds.news.BasicNewsRecipe.parse_index”方法。 它的 工作是访问 https://www.nytimes.com/pages/todayspaper/index.html 并获取 *todays* 报纸中出现的文章列表。 虽然比简单地使用“RSS”更复杂,但该方法创建了一本与每日报纸非常接近的电子书。 ``parse_index`` 大量使用 `BeautifulSoup <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_ 来解析日报网页。 如果您不喜欢 BeautifulSoup,您也可以使用其他更现代的解析器。 calibre 附带 `lxml <https://lxml.de/>`_ 和 `html5lib <https://github.com/html5lib/html5lib-python>`_,这是推荐的解析器。 要使用它们,请将对“index_to_soup()”的调用替换为以下内容:" |
| 384 |
|
| 385 |
#: ../../../__w/calibre/calibre/manual/news.rst:283 |
| 386 |
msgid "" |
| 387 |
"The final new feature is the " |
| 388 |
":meth:`calibre.web.feeds.news.BasicNewsRecipe.preprocess_html` method. It " |
| 389 |
"can be used to perform arbitrary transformations on every downloaded HTML " |
| 390 |
"page. Here it is used to bypass the ads that the nytimes shows you before " |
| 391 |
"each article." |
| 392 |
msgstr "最后一个新功能是“calibre.web.feeds.news.BasicNewsRecipe.preprocess_html”方法。 它可用于对每个下载的 HTML 页面执行任意转换。 这里它用于绕过纽约时报在每篇文章之前向您展示的广告。" |
| 393 |
|
| 394 |
#: ../../../__w/calibre/calibre/manual/news.rst:286 |
| 395 |
msgid "Tips for developing new recipes" |
| 396 |
msgstr "开发新新闻源的技巧" |
| 397 |
|
| 398 |
#: ../../../__w/calibre/calibre/manual/news.rst:288 |
| 399 |
msgid "" |
| 400 |
"The best way to develop new recipes is to use the command line interface. " |
| 401 |
"Create the recipe using your favorite Python editor and save it to a file " |
| 402 |
"say :file:`myrecipe.recipe`. The `.recipe` extension is required. You can " |
| 403 |
"download content using this recipe with the command::" |
| 404 |
msgstr "开发新新闻源的最佳方法是使用命令行界面。 使用您最喜欢的 Python 编辑器创建新闻源并将其保存到文件名为 “myrecipe.recipe”的文件中。 需要“.recipe”扩展名。 您可以使用此新闻源通过以下命令下载内容:" |
| 405 |
|
| 406 |
#: ../../../__w/calibre/calibre/manual/news.rst:292 |
| 407 |
msgid "" |
| 408 |
"The command :command:`ebook-convert` will download all the webpages and save" |
| 409 |
" them to the EPUB file :file:`myrecipe.epub`. The ``-vv`` option makes " |
| 410 |
"ebook-convert spit out a lot of information about what it is doing. The " |
| 411 |
":option:`ebook-convert-recipe-input --test` option makes it download only a " |
| 412 |
"couple of articles from at most two feeds. In addition, ebook-convert will " |
| 413 |
"put the downloaded HTML into the ``debug/input`` folder, where ``debug`` is " |
| 414 |
"the folder you specified in the :option:`ebook-convert --debug-pipeline` " |
| 415 |
"option." |
| 416 |
msgstr "命令“ebook-convert”将下载所有网页并将它们保存到 EPUB 文件“myrecipe.epub”。 “-vv”选项使 ebook-convert 吐出大量有关其正在执行的操作的信息。 “ebook-convert-recipe-input --test”选项使其最多只能从两个提要中下载几篇文章。 此外,ebook-convert 会将下载的 HTML 放入“debug/input”文件夹中,其中“debug”是您在“ebook-convert --debug-pipeline”选项中指定的文件夹。" |
| 417 |
|
| 418 |
#: ../../../__w/calibre/calibre/manual/news.rst:300 |
| 419 |
msgid "" |
| 420 |
"Once the download is complete, you can look at the downloaded :term:`HTML` " |
| 421 |
"by opening the file :file:`debug/input/index.html` in a browser. Once you're" |
| 422 |
" satisfied that the download and preprocessing is happening correctly, you " |
| 423 |
"can generate e-books in different formats as shown below::" |
| 424 |
msgstr "下载完成后,您可以通过在浏览器中打开文件 `debug/input/index.html`来查看下载的“HTML”。 一旦您对下载和预处理正确进行感到满意,您就可以生成不同格式的电子书,如下所示:" |
| 425 |
|
| 426 |
#: ../../../__w/calibre/calibre/manual/news.rst:307 |
| 427 |
msgid "" |
| 428 |
"If you're satisfied with your recipe, and you feel there is enough demand to" |
| 429 |
" justify its inclusion into the set of built-in recipes, post your recipe in" |
| 430 |
" the `calibre recipes forum " |
| 431 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=228>`_ to share it " |
| 432 |
"with other calibre users." |
| 433 |
msgstr "如果您对自己的新闻源感到满意,并且您认为有足够的需求来证明将其包含在内置新闻源集中,请将您的新闻源发布在“calibre 新闻源论坛”<https://www.mobileread.com/forums/forumdisplay.php?f=228>`_ 与其他 calibre 用户分享。" |
| 434 |
|
| 435 |
#: ../../../__w/calibre/calibre/manual/news.rst:310 |
| 436 |
msgid "" |
| 437 |
"On macOS, the command line tools are inside the calibre bundle, for example," |
| 438 |
" if you installed calibre in :file:`/Applications` the command line tools " |
| 439 |
"are in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 440 |
msgstr "在 macOS 上,命令行工具位于 calibre 包内,例如,如果您在“/Applications”中安装了 calibre,则命令行工具位于“/Applications/calibre.app/Contents/MacOS/”中。" |
| 441 |
|
| 442 |
#: ../../../__w/calibre/calibre/manual/news.rst:316 |
| 443 |
msgid ":doc:`generated/en/ebook-convert`" |
| 444 |
msgstr "“生成/en/电子书转换”" |
| 445 |
|
| 446 |
#: ../../../__w/calibre/calibre/manual/news.rst:317 |
| 447 |
msgid "The command line interface for all e-book conversion." |
| 448 |
msgstr "所有电子书转换的命令行界面。" |
| 449 |
|
| 450 |
#: ../../../__w/calibre/calibre/manual/news.rst:321 |
| 451 |
msgid "Further reading" |
| 452 |
msgstr "以后阅读" |
| 453 |
|
| 454 |
#: ../../../__w/calibre/calibre/manual/news.rst:323 |
| 455 |
msgid "" |
| 456 |
"To learn more about writing advanced recipes using some of the facilities, " |
| 457 |
"available in ``BasicNewsRecipe`` you should consult the following sources:" |
| 458 |
msgstr "要了解有关使用“BasicNewsRecipe”中提供的某些工具编写高级食谱的更多信息,您应该查阅以下来源:" |
| 459 |
|
| 460 |
#: ../../../__w/calibre/calibre/manual/news.rst:325 |
| 461 |
msgid ":ref:`API documentation <news_recipe>`" |
| 462 |
msgstr "“API文档<news_recipe>”" |
| 463 |
|
| 464 |
#: ../../../__w/calibre/calibre/manual/news.rst:326 |
| 465 |
msgid "" |
| 466 |
"Documentation of the ``BasicNewsRecipe`` class and all its important methods" |
| 467 |
" and fields." |
| 468 |
msgstr "“BasicNewsRecipe” 类及其所有重要方法和字段的文档。" |
| 469 |
|
| 470 |
#: ../../../__w/calibre/calibre/manual/news.rst:328 |
| 471 |
msgid "" |
| 472 |
"`BasicNewsRecipe " |
| 473 |
"<https://github.com/kovidgoyal/calibre/blob/master/src/calibre/web/feeds/news.py>`_" |
| 474 |
msgstr "`BasicNewsRecipe <https://github.com/kovidgoyal/calibre/blob/master/src/calibre/web/feeds/news.py>`_" |
| 475 |
|
| 476 |
#: ../../../__w/calibre/calibre/manual/news.rst:329 |
| 477 |
msgid "The source code of ``BasicNewsRecipe``" |
| 478 |
msgstr "``基本新闻源``的源代码" |
| 479 |
|
| 480 |
#: ../../../__w/calibre/calibre/manual/news.rst:331 |
| 481 |
msgid "" |
| 482 |
"`Built-in recipes " |
| 483 |
"<https://github.com/kovidgoyal/calibre/tree/master/recipes>`_" |
| 484 |
msgstr "`内置新闻源 <https://github.com/kovidgoyal/calibre/tree/master/recipes>`_" |
| 485 |
|
| 486 |
#: ../../../__w/calibre/calibre/manual/news.rst:332 |
| 487 |
msgid "The source code for the built-in recipes that come with calibre" |
| 488 |
msgstr "calibre自带的内置新闻源的源代码" |
| 489 |
|
| 490 |
#: ../../../__w/calibre/calibre/manual/news.rst:334 |
| 491 |
msgid "" |
| 492 |
"`The calibre recipes forum " |
| 493 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=228>`_" |
| 494 |
msgstr "`calibre 新闻源论坛 <https://www.mobileread.com/forums/forumdisplay.php?f=228>`_" |
| 495 |
|
| 496 |
#: ../../../__w/calibre/calibre/manual/news.rst:335 |
| 497 |
msgid "Lots of knowledgeable calibre recipe writers hang out here." |
| 498 |
msgstr "许多知识渊博的新闻源作家都在这里闲逛。" |
| 499 |
|
| 500 |
#: ../../../__w/calibre/calibre/manual/news.rst:339 |
| 501 |
msgid "API documentation" |
| 502 |
msgstr "API文档" |