Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 09-26-2010, 02:55 AM   #1
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
gmail recipe

i am trying to make a gmail recipe. the address is https://mail.google.com/gmail/feed/atom/. i was thinking it ould be a good idea to logon through https://www.google.com/accounts/Logi...ww.google.com/ and then download the feed. it works in a regular browser when i do it. not working in python. any ideas?

Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1285454835(BasicNewsRecipe):
    title          = u'test1'
    __author__            = 'marbs'
    oldest_article = 7
    max_articles_per_feed = 100
    needs_subscription = True
    feeds          = [(u'test', u'https://mail.google.com/gmail/feed/atom/')]

    LOGIN = 'https://www.google.com/accounts/Login?hl=en&continue=http://www.google.com/'

    def get_browser(self):
        br = BasicNewsRecipe.get_browser()
        if self.username is not None and self.password is not None:
            br.open(self.LOGIN)
            br.select_form(id='gaia_loginform')
            br['Email'] = self.username
            br['passwd'] = self.password
            br.submit()
        return br
marbs is offline   Reply With Quote
Old 09-26-2010, 08:45 AM   #2
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 marbs View Post
i am trying to make a gmail recipe. the address is https://mail.google.com/gmail/feed/atom/. i was thinking it ould be a good idea to logon through https://www.google.com/accounts/Logi...ww.google.com/ and then download the feed. it works in a regular browser when i do it. not working in python. any ideas?

Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1285454835(BasicNewsRecipe):
    title          = u'test1'
    __author__            = 'marbs'
    oldest_article = 7
    max_articles_per_feed = 100
    needs_subscription = True
    feeds          = [(u'test', u'https://mail.google.com/gmail/feed/atom/')]

    LOGIN = 'https://www.google.com/accounts/Login?hl=en&continue=http://www.google.com/'

    def get_browser(self):
        br = BasicNewsRecipe.get_browser()
        if self.username is not None and self.password is not None:
            br.open(self.LOGIN)
            br.select_form(id='gaia_loginform')
            br['Email'] = self.username
            br['passwd'] = self.password
            br.submit()
        return br
You can look at the Google Reader recipe to see how authentication works using the Google API. I did the authentication part of that recipe, but nothing else. I played around with trying to do it the way you're doing it, but found that using the API worked better. There's a thread about Google Reader that has some links to Google API docs. Searching should find it.
Starson17 is offline   Reply With Quote
Old 09-26-2010, 10:17 AM   #3
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
i saw that some time ago

saw you were co auther for that recipe. i started this recipe with playing arround with the google reader, but i dont understand it well enough. when i open the links on that recipe i get pages with raw code. seeing as i didnt know what rss was two weeks ago, i dont really know what to do.

ill run a search and see if i can get any where.
marbs is offline   Reply With Quote
Old 09-26-2010, 03:57 PM   #4
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
well, i ran the search

i went back and read the google reader and the google reader uber recipes.
i found googles stuff on logging on. (http://code.google.com/apis/accounts...alledApps.html) but i dont think i can do much about it. i am willing to do some work, but i dont have the skill yet....
marbs is offline   Reply With Quote
Old 09-27-2010, 09:44 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 marbs View Post
i went back and read the google reader and the google reader uber recipes.
i found googles stuff on logging on. (http://code.google.com/apis/accounts...alledApps.html) but i dont think i can do much about it. i am willing to do some work, but i dont have the skill yet....
You've PM'd me asking for help, and I'm willing to provide it, if you do most of the grunt work. I'm not personally interested in a gmail recipe. I don't think mail is a particularly useful thing to make a recipe for. How will you reply? There are lots of email packages for my devices (WinCE) so I rely on those.

Nonetheless, if you have a burning desire for this and want to dig through the Google API, I (and others here) will help with some of the steps. You have to post exactly what problems you're having. Post relevant parts of the API. Post what you see, etc. It will take you a while to build the skills.
Starson17 is offline   Reply With Quote
Old 09-27-2010, 10:39 AM   #6
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
I replied to you privately before i saw this.
I think the Gmail recipe is a good idea, but it is a little on the back burner. i thought it would be an easy think because there is an exiting XML version of the mail. guess its not so simple.

since i have downloaded calibre, i have decided to learn python. the only problem, is that i also need to learn HTML, XML, RSS and a few other things. i have real troble seeing what is hard and what is easy.

i appreciate any help i can get, but some times (ok, most times) what i dream to have is a little (ok, much) more than i can do, so i need a lot of help. on the up side, i try to help if i know how.

thanks again.
marbs is offline   Reply With Quote
Old 09-27-2010, 12:02 PM   #7
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
This link is to my 4 favorite references for recipes:

http://www.mobileread.com/forums/sho...postcount=1878
Starson17 is offline   Reply With Quote
Old 09-27-2010, 01:24 PM   #8
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
i read three from top to bottom and top again. i started the soup one, but didnt get far. i dont think i read enough other things. what worries me is that i need it for my mega recipe. i am working up towards it.
marbs is offline   Reply With Quote
Old 10-01-2010, 03:43 AM   #9
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
still working on this

this is what i have. if anything comes to mind, please tell me.

import urllib, re, mechanize
from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre import __appname__

Spoiler:
Code:
class GoogleReaderUber(BasicNewsRecipe):
    title   = 'Google Reader uber'
    description = 'Fetches all feeds from your Google Reader account including the uncategorized items.'
    needs_subscription = True
    __author__ = 'davec, rollercoaster, Starson17'
    base_url = 'http://www.google.com/reader/atom/'
    oldest_article = 365
    max_articles_per_feed = 250
    get_options = '?n=%d&xt=user/-/state/com.google/read' % max_articles_per_feed
    use_embedded_content = True

    def get_browser(self):
        br = BasicNewsRecipe.get_browser(self)
        if self.username is not None and self.password is not None:
            request = urllib.urlencode([('Email', self.username), ('Passwd', self.password),
                                        ('service', 'reader'), ('accountType', 'HOSTED_OR_GOOGLE'), ('source', __appname__)])
            response = br.open('https://www.google.com/accounts/ClientLogin', request)
            auth = re.search('Auth=(\S*)', response.read()).group(1)
            cookies = mechanize.CookieJar()
            br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
            br.addheaders = [('Authorization', 'GoogleLogin auth='+auth)]
        return br
    def get_feeds(self):
        feeds = []
        soup = self.index_to_soup('https://mail.google.com/mail/feed/atom')
        for id in soup.findAll('entry', attrs={'href'}):
            url = id['href']
            title       = self.tag_to_string(title)
            description1=self.tag_to_string(summary)
            date1=self.tag_to_string(modified)

            feeds.append({'title': title, 'url': url, 'description':summary, 'date':''}) # append all this
            
           
        return feeds
marbs is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
More Gmail Invites Liqiud Lounge 4 02-03-2005 12:14 PM
Gmail-mobile PHP script for accessing Gmail via WAP Alexander Turcic Lounge 4 09-10-2004 03:41 PM
gmail copy (gmcp) - Perl script to copy files to/from Gmail Colin Dunstan Lounge 0 09-04-2004 01:24 PM
More Gmail for you, hurry! Alexander Turcic Announcements 2 08-30-2004 09:37 AM


All times are GMT -4. The time now is 06:32 AM.


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