05-25-2014, 08:16 AM | #1 |
Junior Member
Posts: 9
Karma: 10
Join Date: May 2014
Device: Kindle Paperwhite 2nd Generation
|
Video Removal from News Feed
I am trying to remove videos from my custom news feed. I have tried everything I know about python and nothing has worked. Can someone tell me what code I need to use in order to get rid of "This video cannot be played because the JavaScript isn't enabled"
Here is the code I made: class AdvancedUserRecipe1400969285(BasicNewsRecipe): title = u'NBC News' oldest_article = 7 max_articles_per_feed = 100 auto_cleanup = True auto_cleanup_keep = '//div[@class="thumbnail"]' filterDuplicates = True remove_empty_feeds = True feeds = [ (u'Top Stories' , u'http://feeds.nbcnews.com/feeds/topstories' ) ,(u'U.S. News' , u'http://feeds.nbcnews.com/feeds/usnews' ) ,(u'Technology' , u'http://feeds.nbcnews.com/feeds/technology' ) ,(u'Investigations' , u'http://feeds.nbcnews.com/feeds/investigations' ) ,(u'Business' , u'http://feeds.nbcnews.com/feeds/business' ) ,(u'Science' , u'http://feeds.nbcnews.com/feeds/science' ) ,(u'Health' , u'http://feeds.nbcnews.com/feeds/health' ) ] remove_tags = [ dict(name='div', attrs={'class''^.*video.*$')}), ] Last edited by vinny3777; 05-25-2014 at 05:48 PM. |
05-25-2014, 10:52 PM | #2 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You cannot use both auto_cleanup and remove_tags. If you set auto_cleanup to true then remove tags will be ignored.
|
Advert | |
|
05-26-2014, 07:59 AM | #3 |
Junior Member
Posts: 9
Karma: 10
Join Date: May 2014
Device: Kindle Paperwhite 2nd Generation
|
I tried that but then no articles came up just links and tables of contents?
Here is the new code class AdvancedUserRecipe1400969285(BasicNewsRecipe): title = u'NBC News' oldest_article = 7 max_articles_per_feed = 100 auto_cleanup = False filterDuplicates = True remove_empty_feeds = True feeds = [ (u'Top Stories' , u'http://feeds.nbcnews.com/feeds/topstories' ) ,(u'U.S. News' , u'http://feeds.nbcnews.com/feeds/usnews' ) ,(u'Technology' , u'http://feeds.nbcnews.com/feeds/technology' ) ,(u'Investigations' , u'http://feeds.nbcnews.com/feeds/investigations' ) ,(u'Business' , u'http://feeds.nbcnews.com/feeds/business' ) ,(u'Science' , u'http://feeds.nbcnews.com/feeds/science' ) ,(u'Health' , u'http://feeds.nbcnews.com/feeds/health' ) ] remove_tags = [ dict(name='div', attrs={'class''^.*video.*$')}), ] Please Help Kovid |
05-26-2014, 01:18 PM | #4 |
Junior Member
Posts: 9
Karma: 10
Join Date: May 2014
Device: Kindle Paperwhite 2nd Generation
|
PLease help anyone!!
|
05-26-2014, 10:31 PM | #5 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you are trying to remove tags that have the word video in their class attributes, you want
remove_tags = [ dict(name='div', attrs={'class':lambda x: x and 'video' in x.split())}), ] |
Advert | |
|
05-30-2014, 06:55 AM | #6 |
Junior Member
Posts: 9
Karma: 10
Join Date: May 2014
Device: Kindle Paperwhite 2nd Generation
|
Did that Kovid but this is the error message that came up
calibre, version 1.37.0 ERROR: Invalid input: <p>Could not create recipe. Error:<br>invalid syntax (<string>, line 23) Here is the code again class AdvancedUserRecipe1400969285(BasicNewsRecipe): title = u'NBC News' oldest_article = 7 max_articles_per_feed = 100 auto_cleanup = False filterDuplicates = True remove_empty_feeds = True feeds = [ (u'Top Stories' , u'http://feeds.nbcnews.com/feeds/topstories' ) ,(u'U.S. News' , u'http://feeds.nbcnews.com/feeds/usnews' ) ,(u'Technology' , u'http://feeds.nbcnews.com/feeds/technology' ) ,(u'Investigations' , u'http://feeds.nbcnews.com/feeds/investigations' ) ,(u'Business' , u'http://feeds.nbcnews.com/feeds/business' ) ,(u'Science' , u'http://feeds.nbcnews.com/feeds/science' ) ,(u'Health' , u'http://feeds.nbcnews.com/feeds/health' ) ] remove_tags = [ dict(name='div', attrs={'class':lambda x: x and 'video' in x.split())}), ] |
Tags |
calibre, news feed, video |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Empty news feed | bubak | Recipes | 4 | 06-14-2011 07:38 PM |
How to create a NEWS Feed | irshwsky | Recipes | 2 | 04-18-2011 01:54 PM |
Two different formats on news feed | TonytheBookworm | Calibre | 3 | 10-06-2010 11:51 AM |
News feed scheduling | nickredding | Calibre | 1 | 01-24-2010 07:28 PM |
The New Yorker news feed | yekim54 | Calibre | 5 | 05-25-2009 09:33 PM |