Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quota defeating / Authentication #36

Closed
Dayjo opened this issue Nov 1, 2016 · 10 comments
Closed

Quota defeating / Authentication #36

Dayjo opened this issue Nov 1, 2016 · 10 comments

Comments

@Dayjo
Copy link

Dayjo commented Nov 1, 2016

Hello!

I've been wondering about overcoming the Quota problem. Currently, I cannot really run any of the calls without getting the Quota error - the first request I did today got the error. Then sometimes it works, other times it doesn't.

I read some suggestions by others about overcoming this by doing a request to login and grabbing the cookies, then sending those cookies with the request to the API so that it thinks you're authenticated and the quota is not so tight.

Not sure if anyone has tried this yet or found other ways to overcome the quota errors?

After grabbing my cookies from the browser after doing a search on google trends, I added them to the trendData.js request and it does actually appear to work, something like this allows me to make more regular requests;

( I have obfuscated the real cookie values )

rp( {
	uri: 'http://www.google.com/trends/fetchComponent?q="' + keyword + '"&cid=TIMESERIES_GRAPH_0&export=3',
	headers: {
		'Cookie': 'APISID=phZcBBd_oF_clAao/A2biC9KLw1Wk42F4H; GMAIL_RTT=223; HSID=AvCAPi1_gcLNPHp04; NID=90\=ljp9bPedFIvbHjyJu_ASSrzAyOjG8bql-141rlIlMUAFUl2whg2O7g6u8Fa0_I5Nf3WteTzfPF4UEp1K5BZw_FLqRXrpdICasdbkRT24zGGkdJHloBLmNZ55hJb2EgUtfsglxlevfPTIeM5bSZ0SmQejORetaXY_yWUvLxQ5NgsxFjMw8eBuqFYruG3aOMhK4jCrc2p8evYPwLMU5t5z1YqdjvBsJw0pWHTHpM7WWWqHhEVvPgZh8SwvAdCTMidd4Q9TTa3bX77lA8hG_kvcaXGApb1ppelSHCE607viCgNYy4pBHAMYypWW9cgX_WxwOmhzvbSjNn21gJZw6TUkadGhEt8vWYjbJUW7q; SAPISID=cZpNlAneFfMDfB3FLx/AB-QxJFQYeWxEY6zB; SID=7gOUsm_siHAB7zmta3cPjuZM-Nos7Ok4pEekdyB_DPpWH3CspzMf4fxnJ7QoWelTrapcMg.; SSID=ASVarA9Iip_lMFg-w;'
			}
});

How reliable this method will be, I'm not sure. Regardless I think something will need to be built in to any app using this to detect the quota and retry later.

@samarv
Copy link

samarv commented Nov 2, 2016

Hey man!

what kindda quota limits you are getting now, after cookies? better than 10/ min or 200/ hr ?

@Dayjo
Copy link
Author

Dayjo commented Nov 2, 2016

Far lower than normal without the cookies, literally the first request I did said that I reached my limit. Apparently Google gives reduced quotas if there are no cookies as it recognises that it's a bot.

It just seemed very inconsistent. However when sending the cookies along with the request I had consistent results, (though i've yet to benchmark how many exactly)

@pat310
Copy link
Owner

pat310 commented Nov 2, 2016

@Dayjo sounds like it's worth a shot - good idea!

@Dayjo
Copy link
Author

Dayjo commented Nov 2, 2016

I'm off to Vietnam for a couple of weeks on Friday so won't get a chance to implement it properly, however I may get a chance when I'm back 👍

@Dayjo
Copy link
Author

Dayjo commented Feb 3, 2017

@pat310 Going to probably get a chance to look into this over the next couple of weeks so will keep you posted! Need to come up with a proof of concept for a reliable way of utilising this.

@KelvinCampelo
Copy link

@Dayjo can you explain to me, what the cookies I need to send... I would be grateful!

@Dayjo
Copy link
Author

Dayjo commented Feb 6, 2017

Hello @KelvinCampelo

As in the code in my first post, the cookies I was sending were;

GMAIL_RTT=223;
HSID=AvCAPi1_gcLNPHp04;
NID=90\=ljp9bPedFIvbHjyJu_ASSrzAyOjG8bql-141rlIlMUAFUl2whg2O7g6u8Fa0_I5Nf3WteTzfPF4UEp1K5BZw_FLqRXrpdICasdbkRT24zGGkdJHloBLmNZ55hJb2EgUtfsglxlevfPTIeM5bSZ0SmQejORetaXY_yWUvLxQ5NgsxFjMw8eBuqFYruG3aOMhK4jCrc2p8evYPwLMU5t5z1YqdjvBsJw0pWHTHpM7WWWqHhEVvPgZh8SwvAdCTMidd4Q9TTa3bX77lA8hG_kvcaXGApb1ppelSHCE607viCgNYy4pBHAMYypWW9cgX_WxwOmhzvbSjNn21gJZw6TUkadGhEt8vWYjbJUW7q;
SAPISID=cZpNlAneFfMDfB3FLx/AB-QxJFQYeWxEY6zB; 
SID=7gOUsm_siHAB7zmta3cPjuZM-Nos7Ok4pEekdyB_DPpWH3CspzMf4fxnJ7QoWelTrapcMg.; 
SSID=ASaVarA9Iip_lMFg-w;

Which I'd extracted from the browser when I'd logged into google. I don't know what they do, I literlaly just copied them all :)

@Dayjo
Copy link
Author

Dayjo commented Feb 9, 2017

Note to self / anyone else; I'm going to be attempting to max out the quota. I would like to go for around 170k requests a month. Hopefully that's within their limit!

@pat310 @dreyco676 no idea if either of you have tried or had anyone else try anything near this number?

@pat310
Copy link
Owner

pat310 commented Feb 10, 2017

@Dayjo I'm not sure, but I would be curious to see what the number is. I'll let you know as soon as it's updated

@pat310
Copy link
Owner

pat310 commented Feb 14, 2017

@Dayjo Closing this for now. Are you going to run a test to see what the limit is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants