View Single Post
Old 01-03-2012, 03:36 PM   #1
Old Linux User
kiavash began at the beginning.
Posts: 36
Karma: 12
Join Date: Jan 2012
Device: NST
Recipe for Microwave Journal?

Hi there,

I know it is my 1st post, but believe me I had done my homework searching/reading as many posts/pages that I could to solve it by myself unsuccessfully. Last resort is asking for help...

So I am trying to write a recipe that downloads articles from Microwave Journal website and convert it to ebook. Like NYT, MWJ also needs user/pass (which is Free, BTW). And also it has RSS site. To login, it sends you to another site and I think (not sure) that once logged in, the other site uses cookies and send the browser back to The login page has a checkbox for Remember me.

With the above foreword, I wrote the following recipe:

PHP Code:
__license__   'GPL v3'


class MWJournal(BasicNewsRecipe):
title          u'Microwave Journal'
oldest_article 30
feeds          = [(u'Current Issue'u'')]

needs_subscription True

    def get_browser
br BasicNewsRecipe.get_browser()
self.username is not None and self.password is not None:
br.select_form(nr 0)
br['EMAIL_ADDRESS']   = self.username
['PASSWORD'] = self.password
.form.find_control(name='remember_me',type="checkbox").get(nr=0).selected True

I got "nr = 0" by inspecting the html file for the login page (the 1st FORM is for username/password). I also did check Remember me box (and tested unchecked too). Anyway, still when the epub is made, the site doesn't consider the user to be logged in (yes! I checked username password to be correct).

I added two attachments. ePub showing the final result (not logged in) and TXT showing ebook-convert output (I manually deleted user/password, otherwise there were there correctly).

Any help would be highly appreciated.

PS. hosts other magazines as well which I searched recipes online repository to see if any of those magazines are already there to reuse the code, but I found none.
Attached Files
File Type: txt recipts_output.txt (14.2 KB, 114 views)
File Type: epub mwjournal.epub (106.9 KB, 68 views)

Last edited by kiavash; 01-06-2012 at 02:01 PM. Reason: Adding Attachments
kiavash is offline   Reply With Quote