Gmail inbox feed XML parsing
in
Contributed Library Questions
•
1 year ago
Hi!
I'm trying to write a parser that would take information from the Gmail inbox feed.
The problem that i have, I think, is associated with authentication and SSL-encryption.
I tried to get information using XML queries (from Daniel Shiffman's SimpleML library), and using loadStrings() function. The result is the same — if the URL is
https://mail.google.com/mail/feed/atom — I get a 401 error (which is expected), but if i enter
https://myaccountname@gmail.com:mypassword@mail.google.com/mail/feed/atom (which works correctly when i type it directly into browser URL bar) i get
- java.net.MalformedURLException: For input string: "password@mail.google.com"
- Something's wrong with the URL: https://account@gmail.com:password@mail.google.com/mail/feed/atom
Here is the code i used:
- import simpleML.*;
- XMLRequest xmlRequest;
- String proto = "https://";
- String acc = "myaccounthere@gmail.com";
- String pass = "mypasswordhere";
- String server = "mail.google.com";
- String path = "/mail/feed/atom";
- void setup() {
- size(200, 200);
- // Creating and starting the request
- xmlRequest = new XMLRequest(this, proto + acc + ":" + pass + "@" + server + path);
- xmlRequest.makeRequest();
- }
- void draw() {
- background(0);
- }
- // When the request is complete
- void netEvent(XMLRequest ml) {
- // Retrieving an array of all XML elements inside "<fullcount>" tags
- String[] counts = ml.getElementArray("fullcount");
- for (int i = 0; i < counts.length; i++) {
- println(counts[i]);
- }
- }
I'll be very grateful if someone can help with some idea.
1