这是用于存档Writing.com的互动故事的Python3实用程序。
存档一个故事将将该故事的每一章下载到./archive/<story_id>/
作为一组可浏览的HTML文件,您可以在浏览器中打开。更新故事将下载任何新章节中的档案。
命令行的用法:
$ cd <path-to-source>
$ pip install -r requirements.txt # Install dependencies
$ chmod +x run.py # If the following commands do not work
$ ./run.py get <id1> <id2>... # Downloads or updates interactives with item_ids <id1>, <id2>...
$ ./run.py get_search "<url1>" "<url2>"... # Downloads every interactive in these search results. See note below.
$ ./run.py update # Update existing archives
一个故事的ittem_id在其URL中:http: http://www.writing.com/main/interact/item_id/$(THIS_IS_THE_ITEM_ID)/map/14411122
要获取适当的URL,请首先在页面左上方的文本框中输入搜索词,然后按Enter(或单击放大镜)。您将被带到搜索结果页面。在此页面上,您将在顶级中心看到您的搜索词。在此右边是一个下拉列表,默认情况下说“要阅读的东西”。在该下拉列表上,选择“互动”,然后在其下方单击“ GO”按钮。现在,所有结果都应该是互动。最后,单击结果上方的放大镜图标以重做搜索。现在,您的URL为get_search的正确形式。不要忘记用“”引用它。
首先使用您的用户名和密码编辑config.yaml登录
python3和requirements.txt
中的软件包。
尝试下载故事时可能会遇到错误。如果错误不会破坏实用程序,我建议尝试再次下载它,因为某些错误是短暂的。但是,让我知道您遇到了什么故事/章节,我会看看我能做什么。
如果错误确实崩溃了实用程序,我建议再次登录。最好的情况要么您的登录时间不成功,要么Writing.com决定停止服务您的会议。删除session
(不是session.py
!),您将再次要求您的凭据。请注意,它不会告诉您登录成功。如果仍然失败,请告诉我。
该实用程序也可以在容器中运行。容器处理安装运行实用程序所需的所有依赖项。
$ cd < path-to-source >
$ docker-compose build
$ docker-compose run writing.com-archival
# After running the above commands, the command line arguments stay the same.
root@writing-com-archival:/code# ./run.py get < id 1> < id 2> ... # Downloads or updates interactives with item_ids <id1>, <id2>...
root@writing-com-archival:/code# ./run.py get_search " <url1> " " <url2> " ... # Downloads every interactive in these search results. See note below.
root@writing-com-archival:/code# ./run.py update # Update existing archives
docker-compose build
此命令将使用docker-compose.yml文件来构建dockerfile内定义的容器。 docker-compose run writing.com-archival
此命令将使用docker-compose.yml文件在当前的shell session中交互方式运行writing.com-archival容器。请勿将git用于bash运行此命令。