-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Abirdcfly/patch-2
Create Pro_Git_ZH.recipe
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from calibre.web.feeds.recipes import BasicNewsRecipe | ||
|
||
class Pro_Git_ZH(BasicNewsRecipe): | ||
|
||
title = 'Pro_Git_ZH' | ||
description = 'Pro_Git_Chinese' | ||
cover_url = 'http://iissnan.com/progit/assets/img/pro-git-cover.jpeg' | ||
|
||
url_prefix = 'http://iissnan.com/progit/' | ||
no_stylesheets = True | ||
keep_only_tags = [{ 'class': 'col-md-8' }] | ||
|
||
def parse_index(self): | ||
soup = self.index_to_soup(self.url_prefix) | ||
|
||
div = soup.find('ul', { 'class': 'toc' }) | ||
|
||
articles = [] | ||
for link in div.findAll('a'): | ||
|
||
til = link.contents[0].strip() | ||
url = self.url_prefix +'/'+ link['href'] | ||
a = { 'title': til, 'url': url } | ||
|
||
articles.append(a) | ||
|
||
ans = [('Pro_Git_ZH', articles)] | ||
|
||
return ans |