mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Translated by disylee 2014/5/21
This commit is contained in:
parent
6534e42976
commit
f353484766
@ -1,108 +0,0 @@
|
||||
disylee来占坑2014-5-20
|
||||
How to download webcomics from the command line on Linux
|
||||
================================================================================
|
||||
Do you never miss a new strip from xkcd? Read webcomics regularly? Or would you like to back up all the strips of your favorite website? Hopefully, the open source community has the solution: a command line program to download all your favorite webcomics from your terminal.
|
||||
|
||||
Before we begin, remember that you should keep these downloaded strips for your personal use, and not broadcast them without permission. If you really like an author's work, support the comic by donating or buying some of the merchandise.
|
||||
|
||||
### Install Dosage on Linux ###
|
||||
|
||||
The open source program to download webcomics is called [dosage][1]. There are a couple of ways to install this webcomic downloader on your machine since it is written in Python. Today we will go with an easy way.
|
||||
|
||||
First, you will need to [install pip][2]. Also, make sure that you have at least Python 2.7.0 or Python 3.3 installed. Then use pip to install dosage as follows.
|
||||
|
||||
$ sudo pip install dosage
|
||||
|
||||
If pip cannot somehow find the package (like on Ubuntu 14.04), use the following command instead.
|
||||
|
||||
$ sudo pip install http://wummel.github.io/dosage/dist/dosage-2.13.tar.gz
|
||||
|
||||
dosage will automatically create a new folder called "Comics" in your home directory.
|
||||
|
||||
### Basic Usage of Dosage ###
|
||||
|
||||
dosage's basic usage can be described as follows. Using dosage, you can find webcomics in the database that you are interested in reading, download the strips, and easily fetch the latest strips as they come out. In a sense, you more or less subscribe to a webcomic, and dosage will take care of making sure that you never miss any unread strips.
|
||||
|
||||
To start downloading and reading offline your webcomics, begin by listing them with the command:
|
||||
|
||||
$ dosage -l
|
||||
|
||||
Right now, dosage has over 2000 comics in its database. My personal tip is if you are looking for a particular webcomic, use the syntax:
|
||||
|
||||
$ dosage -l | grep [keyword]
|
||||
|
||||
It will then return all the comics with title containing [keyword].
|
||||
|
||||
Once you decided which comic you wanted to subscribe to from the list, use this command to subsribe to the comic:
|
||||
|
||||
$ dosage [name of the webcomic]
|
||||
|
||||
![](https://farm3.staticflickr.com/2940/13943751585_978ef260de_z.jpg)
|
||||
|
||||
Subscribing to a comic will automatically create a folder in the "Comics" directory, and download the latest strip of that webcomic.
|
||||
|
||||
If instead of downloading just the latest strip, you are interested in all the issues, use this command:
|
||||
|
||||
$ dosage -a [name of the comic]
|
||||
|
||||
Finally, once you subscribed to a couple of webcomics, you can easily download the latest strip of all of them in one shot with the simple command below:
|
||||
|
||||
$ dosage @
|
||||
|
||||
If you never want to miss your daily comics for example, you should run this command every day.
|
||||
|
||||
### Advanced Usage of Dosage ###
|
||||
|
||||
Past the first day playing around with dosage, you might want to get the most out of it. It entails knowing a bit more about the command's syntax and shortcuts.
|
||||
|
||||
If you tried to download some xkcd strips, you might have noticed that dosage refuses with the message:
|
||||
|
||||
use the --adult option to confirm your age
|
||||
|
||||
![](https://farm3.staticflickr.com/2929/13920634111_9d63589f74_z.jpg)
|
||||
|
||||
Because by default dosage will ignore any webcomic flagged for people over 18 (and for some reason xkcd is one of them). To bypass that, just do as it says:
|
||||
|
||||
$ dosage --adult xkcd
|
||||
|
||||
From a previous example, you may have noticed that the argument '@' is used to refer to all downloaded comics. A continuation is '@@' for all comics in dosage database.
|
||||
|
||||
$ dosage @@
|
||||
|
||||
The above command will download the latest strip of every comic that dosage knows about.
|
||||
|
||||
If you want to fetch the strips from the beginning of the series up to a particular day, you can do:
|
||||
|
||||
$ dosage -a [name of the comic]:[year-month-day]
|
||||
|
||||
For example, to see all of Calvin and Hobbes' strips from 2014 until its creation, run:
|
||||
|
||||
$ dosage -a calvinandhobbes:2014-01-01
|
||||
|
||||
Finally for all the developers out there who would like to do something of these strips for your personal use, dosage integrates the possibility of generating rss, json, and html log files while downloading strips:
|
||||
|
||||
$ dosage -o [type] [name of the comic]
|
||||
|
||||
In the above command, [type] is either rss, json, or html, and [name of the comic] can also be just '@'. For example, the "html" argument will create a nice HTML code to see all the strips downloaded:
|
||||
|
||||
The command below will download all the strips for Calvin and Hobbes, and then spit out an HTML code to view in your web browser all the strips in a nice webpage format.
|
||||
|
||||
$ dosage -o html -a calvinandhobbes
|
||||
|
||||
![](https://farm4.staticflickr.com/3693/13920644962_1b041dc2f2_z.jpg)
|
||||
|
||||
To conclude, I invite you to read the [manual page][3] for more information. dosage is a really neat tool, and I know that it will be of great use to any fans of webcomics out there. I'm very curious to know what can come out of the fancier options like creating a json file out of downloaded strips.
|
||||
|
||||
Do you have an alternative to dosage? Or are you actually a fan of the latter and use it regularly? Let us know in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/04/download-webcomics-command-line-linux.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://wummel.github.io/dosage/
|
||||
[2]:http://ask.xmodulo.com/install-pip-linux.html
|
||||
[3]:http://wummel.github.io/dosage/dosage.1.html
|
@ -0,0 +1,106 @@
|
||||
|
||||
|
||||
在Linux系统中,如何通过命令行变出二次元世界?
|
||||
================================================================================
|
||||
你是否从来都没有错过xkcd上的漫画连载?及时地阅读到网络漫画。或者你是否考虑过从你喜欢的网站上备份所有漫画连载?如你所愿,开源社区将为你提供解决方案:使用命令行程序从终端上下载所有你喜欢的漫画连载。
|
||||
|
||||
|
||||
在我们开始之前,请记住一点,你下载的漫画连载仅供个人使用,在没有授权的情况下是不可以散播出去的。如果你确实喜欢该作者的作品,请支持通过捐赠或购买正版商品获得。
|
||||
|
||||
|
||||
在Linux中安装Dosage
|
||||
|
||||
|
||||
有一个下载漫画连载的开源程序叫dosage。由于该程序是用python写的,所以安装漫画连载工具的方式有几种。今天我们就从一种简单的方法开始吧。
|
||||
|
||||
第一步,你需要安装pip(用于安装和管理python包的工具),并确保你的python版本在2.7.0至3.3区间。接下来使用pip安装dosage。
|
||||
|
||||
$ sudo pip install dosage
|
||||
|
||||
如果pip不能以某种方式来找到相关包(例如Ubuntu14.04系统),可以使用下列命令来找到。
|
||||
|
||||
$ sudo pip install http://wummel.github.io/dosage/dist/dosage-2.13.tar.gz
|
||||
|
||||
dosage将会自动创建一个名为“Comics”新的文件夹。
|
||||
|
||||
|
||||
Dosage的基本用法
|
||||
|
||||
dosage的基本用法可以被描述如下。使用dosage,你可以在数据库中找到你喜欢阅读的网络漫画,当最新一期的连载发布时,你可以几时获取最新一期。从某种意义来说,无论你在网络漫画中订阅多少连载,dosage都会确保一期不落地帮你把没有读过的漫画连载下载下来。
|
||||
|
||||
下载和阅读你的离线网络漫画,首先要用以下命令将它们列出:
|
||||
|
||||
$ dosage -l
|
||||
|
||||
马上,我们可以看到dosage将2000多套漫画从数据库列出。我个人建议用下面的这个命令来查找我们想要看的漫画:
|
||||
|
||||
$ dosage -l | grep [keyword]
|
||||
|
||||
这样就会返回所有包含关键字标题的漫画了。
|
||||
一旦你确定列表中哪一本漫画是你想要阅读的,使用一下命令订阅这本漫画:
|
||||
$ dosage [name of the webcomic]
|
||||
|
||||
![](https://farm3.staticflickr.com/2940/13943751585_978ef260de_z.jpg)
|
||||
|
||||
订阅漫画时会自动生成一个名为"Comics"的目录,并把最新的连载漫画下载到在里边。
|
||||
如果你不仅仅像下载最新连载的漫画而是整一部,那么你使用一下的命令就可以了:
|
||||
|
||||
$ dosage -a [name of the comic]
|
||||
|
||||
最后,如果你订阅了几本网络漫画,你可以使用下面这条简单的命令,方便地下载到这几本漫画的所有更新:
|
||||
|
||||
$ dosage @
|
||||
|
||||
如果你不想错过每天的漫画更新,你可以每天执行这条命令确保不会错过。
|
||||
|
||||
Dosage的高级用法
|
||||
|
||||
玩了一天dosage,你也许想知道它的更多使用方法。这需要你掌握更多的命令语法和快捷入门。
|
||||
如果你想在xkcd上下载更多的漫画连载,你应该会看到一条dosage拒绝的提示(使用成人选项,确认你的年龄):
|
||||
|
||||
use the --adult option to confirm your age
|
||||
|
||||
|
||||
![](https://farm3.staticflickr.com/2929/13920634111_9d63589f74_z.jpg)
|
||||
因为默认情况下,dosage会为18岁以上的成年人忽略所有网络漫画中产生的冲突(xkcd只是其中的一个)。跳过这一步,请输入:
|
||||
|
||||
$ dosage --adult xkcd
|
||||
|
||||
从之前的例子,你也许注意到'@'这个参数几乎用于所有关于漫画书的下载。接下来这个'@@'这个参数是关于dosage数据库的所有漫画书。
|
||||
|
||||
$ dosage @@
|
||||
|
||||
上面的命令会下载dosage所知道的每一本漫画的最新连载。
|
||||
如果你想获取漫画开始到特定某一天的连载,你可以使用以下命令:
|
||||
$ dosage -a [name of the comic]:[year-month-day]
|
||||
|
||||
举个例子,我们想看《Calvin and Hobbes》2014年之前的所有连载,运行这条命令:
|
||||
|
||||
$ dosage -a calvinandhobbes:2014-01-01
|
||||
|
||||
最终对所有想把连载作为个人用途的开发者,dosage会在下载连载时生成rss,json和html日志文件。
|
||||
|
||||
$ dosage -o [type] [name of the comic]
|
||||
|
||||
在以上命令中,,[type]可以是rss,json或者html,[name of comic]也可以只用'@'。例如,用'html'参数就回创建一个漂亮的HTML代码可以看到所有已经下载到的漫画连载。
|
||||
|
||||
下面的命令会下载所有关于Calvin and Hobbes的连载并生成一个网页代码,在你的浏览器中看到一个漂亮的网页格式呈现出所有连载漫画。
|
||||
$ dosage -o html -a calvinandhobbes
|
||||
|
||||
![](https://farm4.staticflickr.com/3693/13920644962_1b041dc2f2_z.jpg)
|
||||
|
||||
最后,我会建议你阅读手册3获取更多相关信息。dosage的确是一个非常简洁的工具,它为广大网页漫画迷们服务。我很好奇地想知道像创建出一个json文件来下载连载漫画的这种创意是怎么诞生的?
|
||||
|
||||
你还有其它更好的工具来取代dosage?或者说你是这种可以取代dosage工具的粉丝并且用得非常过瘾,那就在评论里推荐给我们吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/04/download-webcomics-command-line-linux.html
|
||||
|
||||
译者:disylee(https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://wummel.github.io/dosage/
|
||||
[2]:http://ask.xmodulo.com/install-pip-linux.html
|
||||
[3]:http://wummel.github.io/dosage/dosage.1.html
|
Loading…
Reference in New Issue
Block a user