Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 07-08-2011, 12:49 PM   #1
yoss15
Enthusiast
yoss15 began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jul 2011
Device: Kindle
World Socialist Web Site

Hi,

Would someone mind writing a recipe for the World Socialist Web Site, www.wsws.org?

Something that grabs all the article for the day, preferably with the "perspective" article first, any commentary articles for the day second and then the news articles last if that is possible.

The RSS is http://www.wsws.org/rss/en.xml

Please let me know if you need anything else, thanks.
yoss15 is offline   Reply With Quote
Old 07-11-2011, 10:50 AM   #2
yoss15
Enthusiast
yoss15 began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jul 2011
Device: Kindle
OK so I've tried to do what I can to make my own recipe but I have no experience with this at all besides some basic knowledge of HTML.

Here is what I have so far

Code:
lass AdvancedUserRecipe1310393888(BasicNewsRecipe):
    title          = u'World Socialist Web Site'
    oldest_article = 7
    max_articles_per_feed = 100

    feeds          = [(u'World Socialist Web Site', u'http://www.wsws.org/rss/en.xml')]
def print_version(self, url):
    return url.replace('http://', 'http://wsws.org/tools/index.php?page=print&url=')	

remove_tags_before    = dict(id='page')

remove_tags_after   = dict(id='page')
The remove tags lines don't seem to be working for me, I'm not sure what I'm doing wrong, any ideas?
yoss15 is offline   Reply With Quote
Advert
Old 07-11-2011, 02:09 PM   #3
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by yoss15 View Post
OK so I've tried to do what I can to make my own recipe but I have no experience with this at all besides some basic knowledge of HTML.

Here is what I have so far

Code:
lass AdvancedUserRecipe1310393888(BasicNewsRecipe):
    title          = u'World Socialist Web Site'
    oldest_article = 7
    max_articles_per_feed = 100

    feeds          = [(u'World Socialist Web Site', u'http://www.wsws.org/rss/en.xml')]
def print_version(self, url):
    return url.replace('http://', 'http://wsws.org/tools/index.php?page=print&url=')	

remove_tags_before    = dict(id='page')

remove_tags_after   = dict(id='page')
The remove tags lines don't seem to be working for me, I'm not sure what I'm doing wrong, any ideas?
You're missing the "c" in class and the def print_version, and both removes must be indented to the level of "title."
Starson17 is offline   Reply With Quote
Old 07-11-2011, 07:44 PM   #4
yoss15
Enthusiast
yoss15 began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jul 2011
Device: Kindle
I think the missing "c" in class was just from copying and pasting to here.

Also how do the indentations work? Because I added the print version and didn't indent it and it cleaned things up a whole lot. Do I hit tab? Because it looks like a lot more space than in the tutorial so I wasn't sure haha.

I tried it with hitting tab and it gave me a different looking result but only slightly, it didn't remove the header and footer which I was trying to get rid of with the remove before and after lines.

Any ideas?
yoss15 is offline   Reply With Quote
Old 07-13-2011, 10:12 AM   #5
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by yoss15 View Post
I think the missing "c" in class was just from copying and pasting to here.
That's what I suspected, too.

Quote:
Also how do the indentations work? Because I added the print version and didn't indent it and it cleaned things up a whole lot. Do I hit tab? Because it looks like a lot more space than in the tutorial so I wasn't sure haha.

I tried it with hitting tab and it gave me a different looking result but only slightly, it didn't remove the header and footer which I was trying to get rid of with the remove before and after lines.

Any ideas?
Look at some sample recipes (there are many here and in the manual) and read up on Python. If you don't indent correctly, you will get errors, or your code will be ignored.
Starson17 is offline   Reply With Quote
Advert
Reply

Tags
socialist, wsws


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cookies in your web site Teles enTourage Archive 3 08-15-2010 06:33 PM
RAPIDSHARE WEB SITE cavi News 37 02-24-2010 09:48 AM
Just came across this web site pathfinderca Which one should I buy? 3 07-08-2008 10:44 AM
NAEB web site? JWLaRue Bookeen 52 03-31-2008 11:17 PM


All times are GMT -4. The time now is 11:20 AM.


MobileRead.com is a privately owned, operated and funded community.