Access New Messages From Yahoo Mail Using YQL

I am currently writing a JAVA application in which I need to access the following information from Yahoo users email messages (in order to return to them). YQL looked like a β€œquick easy way”, but it turned out to be more complicated. All the tests that I ran were performed here: http://developer.yahoo.com/yql/console/ I can reproduce the same results using my webapp / oauth.

  • For
  • FromEmail
  • Fromname
  • Theme
  • Message
  • the date
  • MID

I'm having trouble getting this request for one request (or even 2, although I have not invested so much time to research this as a solution). This is its drawback, currently I have the following YQL:

SELECT folder.unread, message FROM ymail.msgcontent WHERE (fid,mids ) IN (SELECT folder.folderInfo.fid, mid FROM ymail.messages WHERE numMid=2 AND startMid=0) AND fid='Inbox' AND message.flags.isRead=0; 

This works the best of all the solutions that I have, however there is one serious drawback. If we have 10 emails, E1 - E10, and they are all unread, except for E2, E3, then after running this query, the result set will display E1, not E1, E4. Obviously, this is not good. So I tried to include "AND message.flags.isRead = 0" in sub select:

 SELECT folder.unread, message FROM ymail.msgcontent WHERE (fid,mids ) IN (SELECT folder.folderInfo.fid, mid FROM ymail.messages WHERE numMid=10 AND startMid=0 AND message.flags.isRead=0) AND fid='Inbox' 

However, this result returns "null". To debug this, I simply run sub select and come up with the following:

 SELECT folder.folderInfo.fid, mid FROM ymail.messages WHERE numMid=10 AND startMid=0 AND messageInfo.flags.isRead=0 

This query returns 10, unfortunately, after further analysis, it does not filter read VS unread. After some conversation, I change the select statement to the following query:

 SELECT folder.folderInfo.fid, messageInfo.mid FROM ymail.messages WHERE numMid=10 AND startMid=0 AND messageInfo.flags.isRead=0 

Finally it works! EXCEPT 47 emails will be returned instead of 10 and to make things more interesting, I know that I have 207 (unread) emails in my inbox, so why 47? I changed "numMid" (think of it as how many impressions) from 0 to 300 and startMid (how many letters start as an offset) from 0 to 300, and do not change the number of result sets. Of course, when I change the select statement again from "messageInfo.mid" to "mid" numMid / startMid "work", however, filtering from it isRead no longer works. I know there are other solutions in which I set numMid = 50000 or something like that, but from the very beginning, YQL is a bit slower, and I can only assume that this will slow it down significantly.

So the question is, has anyone done this? Is YQL just broken / not supported or am I doing something wrong?

Thanks!

EDIT . Apparently, this is "47", which appears from the first 50 letters that I have, 3 of which are read. I have yet to figure out how to β€œfool” YQL to allow me to overcome this 50 limit.

+4
source share
1 answer

A bit late, but I think I have the answer to your question.

Your request is almost correct, except for the numInfo request numInfo . Try changing your request to

SELECT * FROM ymail.messages WHERE numMid = 75 AND startMid = 0 AND numInfo = 75 AND messageInfo.flags.isRead = 0

Pay attention to numInfo=75 . This should give you the last 75 unread messages. For more information on the various query parameters, see the official documentation here.

EDIT 1
The ymail.messages table should return unread messages by default. There is a GroupBy parameter that you must use if you want to receive unread messages. Find the documentation here

0
source

Source: https://habr.com/ru/post/1441868/


All Articles