Add :smart :noref modes, update README
This commit is contained in:
		@@ -40,6 +40,8 @@ The arguments are:
 | 
				
			|||||||
- Advanced
 | 
					- Advanced
 | 
				
			||||||
	- `csv`: export to csv
 | 
						- `csv`: export to csv
 | 
				
			||||||
	- `md`: convert articles to Markdown
 | 
						- `md`: convert articles to Markdown
 | 
				
			||||||
 | 
						- `nolink`: drop links, but keeps links' inner text
 | 
				
			||||||
 | 
						- `noref`: drop items' link
 | 
				
			||||||
	- `cache`: only take articles from the cache (ie. don't grab new articles' content), so as to save time
 | 
						- `cache`: only take articles from the cache (ie. don't grab new articles' content), so as to save time
 | 
				
			||||||
	- `debug`: to have some feedback from the script execution. Useful for debugging
 | 
						- `debug`: to have some feedback from the script execution. Useful for debugging
 | 
				
			||||||
	- `theforce`: force download the rss feed
 | 
						- `theforce`: force download the rss feed
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ from fnmatch import fnmatch
 | 
				
			|||||||
import re
 | 
					import re
 | 
				
			||||||
import json
 | 
					import json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lxml.etree
 | 
				
			||||||
import lxml.html
 | 
					import lxml.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import feeds
 | 
					import feeds
 | 
				
			||||||
@@ -628,6 +629,16 @@ def After(rss, options):
 | 
				
			|||||||
			if not options.keep:
 | 
								if not options.keep:
 | 
				
			||||||
				del item.desc
 | 
									del item.desc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if options.nolink and item.content:
 | 
				
			||||||
 | 
								content = lxml.html.fromstring(item.content)
 | 
				
			||||||
 | 
								for link in content.xpath('//a'):
 | 
				
			||||||
 | 
									log(link.text_content())
 | 
				
			||||||
 | 
									link.drop_tag()
 | 
				
			||||||
 | 
								item.content = lxml.etree.tostring(content)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if options.noref:
 | 
				
			||||||
 | 
								item.link = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if options.md:
 | 
							if options.md:
 | 
				
			||||||
			conv = HTML2Text(baseurl=item.link)
 | 
								conv = HTML2Text(baseurl=item.link)
 | 
				
			||||||
			conv.unicode_snob = True
 | 
								conv.unicode_snob = True
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user