Gmail Automation via Bash (To refresh POP Fetch from other accounts) - javascript

Gmail has this option to fetch mails from other accounts. I used this feature to create a central mail box. Works good.
Gmail periodically polls other mail box over POP. But the frequency is 1 hour + , sometimes even more than that. There is no option to pull mails manually on mobile gmail version. But the full blow gmail web (not basic HTML Version) has has a REFRESH button on top which will fetch mails from other boxes right away. Also, under settings there is option to CHECK MAILS. Does the same.
Is there a way to automate a gmail login, click the REFRESH button and exit every 10 minutes?
I am comfortable with WGET, if it was a basic HTML, could have automated. But there is a lot of javascript processing before the page is loaded, and I am lost where to begin javascript automation via bash.
Any leads will help, Thanks.

Related

Is there a way to perform a "Submit" function outside of the website?

I am trying to figure out if it is possible to click on a button on the Amazon website from outside of the website.
For Example: At the bottom of every product review is a "Helpful" button. If a review was helpful, the reader/shopper can click this button to let the reviewer (and Amazon) know that the review was helpful. (It's basically a "Like" button).
What I'm trying to accomplish:
I want to post my reviews on my own website/blog and still obtain "Likes" without asking readers to click a link to a product page, then search for my review, then click the button.
You probably won't be able to do what you have in mind.
JavaScript can generally access information on another domain except if specifically configured in the origin website through CORS. Unless you own amazon.com, you won't be able to configure amazon's CORS headers to make them accessible to some JS running on your website.
You can however, from your website front-end, make a request to your website back-end that would be able to access amazon's data just like your browser does. Using a browser emulator like Puppeteer, you'll be able to launch an amazon page and programmatically retrieve infos, click on things and do other stuff.
However, the page that Puppeteer will be able to spin up will include credentials (cookies, localstorage content, auth token, etc) provided by your server, so Puppeteer will not see the same amazon.com your user sees on his browser, unless your user agrees to give you its amazon credentials, and at this point I'm pretty sure no user would do that, and that would not be authorized by amazon's terms of services.
TL;DR even if what you have in mind is not impossible, it would weeks for your and your team to code a system that would potentially allow you to do that, and that's provided the law is on your side, which is probably not the case.

Ionic/Angular/JS Create a click event to automate process

I am making an app that will preform several functions at once, the functions are sending an SMS and posting a message to Facebook and twitter
however, I have hit a wall, I can not find any information on how to automatically post to Facebook and Twitter and send an SMS.
I do not want the user to wait for the SMS messenger APP to open then tap send, then wait for Facebook to open then tap send and then wait for twitter to open and then tap send.
I want to send an SMS and Post to socials all at once.
is there any solution or advice for me and where to look.
I am using the IONIC shareSocials Plugin.
The only way would be via API integrations (but still..)
Remark: This would require the whole package..
Registering and setting up your app-clients for both FB and Twitter to allow integrating with their API's and allowing users to authenticate;
You'll need to implement the user authentication within your app to get their tokens after authenticating;
Handeling the auth-tokens in a secure way;
...
Below are the related API sections.
Twitter:
https://developer.twitter.com/en/docs/tweets/post-and-engage/overview
Facebook (only allows publishing to pages, not sure if there is still a way to post something to a user's feed):
https://developers.facebook.com/docs/graph-api/using-graph-api/#publishing
If you want SMS to be automated as well, you could look at SMS gateway API's, but these are not free (for large amounts) and are sending from a "general" number, not the user's number.
Example: https://gatewayapi.com/
If you will take a close look at those APIs you will see, that they return a page in response. This happens for a safety reason, this way they assure, that your data wasn't stolen. If the credentials are there, you go directly to the "message" view. But it is also another level of control, and posting without user interaction is a policy violation.
There was a way to post something without user interaction with opengraph, but now they are even more cautious about such things. That is also against their policy, which was recently renewed.

I would like to build a code that checks my imported mail in Gmail in Google Apps Script, how do I find this function?

As you might know, Gmail has the feature to check other email accounts (using pop3). I am using this feature a lot, but the annoying thing is it only checks the email once every 50 minutes of you have to do this manually in the settings, and the settings aren't available on mobile.
I would like to build something to check this mail automatically every minute. The best would be a Google Apps Script, because it is linked with Gmail and it can automatically run from the cloud every minute. The only problem is that I don't know how to make a javascript that automatically does the 'get mail now' feature. How would I build this?
Google Script cannot be used for checking emails of other Google accounts.

Take screenshot via PHP and Javascript

I have a chat system and I want to protect my users from malicious websites, and sometimes people sends a URL through the chat system, and users click on it and access some scam sites. I have that protect page like redirect.php?url=someurl.com that alerts the users that URL can be a malicious website, and the users have to click on Continue button to access the link. But I want to give them one more option which is See a preview, and clicking on it, a new tab will be opened with a screenshot, or if it's not possible only with PHP and Javascript, show a clean version of the page without Javascript.
How can I do this?
I'm planning of make use of file_get_contents(), save it to some preview text, cleaning the <script> tag of the page, but it'll be enough?
Lots of such screen capture web service here:
What's the best website screenshot capture API?
But instead of doing that by yourself, I think you should go with those many public link-shortening service, like t.co, because anti-malicious is already one of their purpose:
Having a link shortener protects users from malicious sites that
engage in spreading malware, phishing attacks, and other harmful
activity. A link converted by Twitter’s link service is checked
against a list of potentially dangerous sites. Users are warned with
the error message below when clicking on potentially harmful URLs.
Try this solution :): html2canvas
[outofdate] http://html2canvas.hertzen.com/screenshots.html
--
Update: http://html2canvas.hertzen.com

Twitter connect from website without popup

I have a problem with a website I'm currently working on.
I have added a Tweet box to my page for the user to tweet about the current article. If the user submits from the Tweet box and is not currently logged in or is not connected with my site, he/she gets a popup from twitter asking for username/password and/or if he/she accepts the connection with my site.
If the user accepts the popup is closed and all is good, if the user declines the window is just closed and the tweet remains a dream of what could have been.
So far so good, But! My site is mainly aimed at smartphones (in particular iPhone), and if the user adds my site to the home screen (which I recommend) then the twitter popup fills the whole app window. This I can understand, and everything works out if the user accepts.
If, on the other hand the user declines, there is no window for the button to close so noting happens. My webapp is running fullscreen and standalone so doesn’t even have a back button. So if the user doesn’t accept the twitter connect, he/she basically needs to restart the app to get avay from the “popup”.
So (finally ;) ) my question is this; is there a twitter page that performs the connect authentication that is not required to be in a popup? A page that basically sends you back to the callback url on both accept and cancel? Or is there a different approach that I have over looked?
Looking forward to some helpful tips!
EDIT
I was suggested The standard OAuth flow and Web intents, the problem is that the app needs to be client code/javascript only. This makes The standard OAuth flow impossible because it sends application secrets over http/https wich makes me put the secrets in the javascript ( I might be somewhat of a hobbyist programmer but there are limits ;) ).
Web intent pages don't have a cancel/back button so I'm still stuck if the user dont want to connect and is running my app in stanalone mode.
I guess I should have included this in the original post, thanks anyway for the suggestions.
The standard OAuth flow for Twitter does not require a popup. You can instead redirect the current window. You will then have to process the the form submit yourself and post the status through your server.
You might also checkout Web Intents. The user posts the tweet from a mobile optimized twitter.com page.

Categories

Resources