Making ebooks with calibre and python---python and git tutorials

Source: Internet
Author: User

Calibre-e-book Management is a very powerful ebook management software that can open and convert ebooks in various formats, can crawl news to local reading, allow users to customize news feeds, You can write your own recipe Let it crawl the content on the Web page and generate ebook, take advantage of this feature I will Liaoche Teacher's Python tutorial and git tutorial made an epub ebook, using the Firefox Epubreader plugin can open reading on the computer, Mobile phone in more like reading can also, this experience for vacation home without network but want to learn the students are still good.

Recipe uses Python to write, with the learning of Python to acquire learning resources, strengthen practice, the operation is very simple, download Calibre-e-book management know, calibre also for the writing of recipe provides API documentation

Here is the recipe code to crawl the Python tutorial

#!/usr/bin/env python#Vim:fileencoding=utf-8 from __future__ Importunicode_literals, Division, Absolute_import, Print_function fromCalibre.web.feeds.newsImportBasicnewsrecipeclassLiaoxuefeng_python (basicnewsrecipe): Title='Liaoche Python Tutorials'Description='Python Tutorials'Max_articles_per_feed= 200Url_prefix='http://www.liaoxuefeng.com'no_stylesheets=True keep_only_tags= [{'ID':'Main'}] Remove_tags=[{'class':'X-wiki-info'}] Remove_tags_after=[{'class':'x-wiki-content x-content'}]        defget_title (self, link):returnLink.contents[0].strip ()defParse_index (self): Soup= Self.index_to_soup ('http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000') Div= Soup.find ('Div', {'class':'X-wiki-tree'}) Articles= []         forLinkinchDiv.findall ('a'): til=self.get_title (link) URL= Self.url_prefix + link['href'] a= {'title': Til,'URL': URL} articles.append (a) tutorial= [('Liaoche Python Tutorials', articles)] returnTutorial

Crawl git tutorial just need to change the Parse_index method in the Python tutorial link to the Git tutorial link, the finished product in this tutorial

Making ebooks with calibre and python---python and git tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.