I want to make a browser plugin that works as follows:
The user enables the plugin. He then has a thumbs up and a thumbs down appear on the screen somewhere. If he clicks thumbs up, it means he likes the current web page he is viewing. If he clicks thumbs down, it means he doesn't — similar to how you vote on YouTube videos
The responses will be collected from many users to a website I setup
The plugin will allow people to see how many people voted a thumbs up and thumbs down for the current page they are viewing
Does anyone know how I am supposed to collect, aggregate, and return the values of the responses? Also, I would need to be able to know the ID of each user because I want to be able to perform future operations based on a user's past behavior. Can I avoid planting a cookie, in case they delete them, and have an ID that is stored in the extension's local files?
I'm sorry if this wasn't clear or if I should unpack it a bit more. I'm familiar with Wordpress, so a solution with that would be great.
From your requirements what i understand is For uniquely identifying a user, you can assign a Unique ID to a user who installs your Extension. For details look this answer https://stackoverflow.com/a/23854032/6428485
You can use content script to add Thumbs Up, and Thumbs Down icons in website. When user clicks thumbs up/down you can use background script of extension to send vote, UserID, and website URL through POST Request to your server to store.
You can collect votes from any user by above method and store it on your server.
Next time when any user visits that URL you can make a GET Request to your server and get number of likes and dislikes against that URL and display them on website using content script.
Hope this helps. Let me know if you need any clarification.
Related
We are implementing a facebook share dialog so users can share images from their accounts. Those images are hosted on S3 and we use expiring links to ensure that normally user images are only accessible to them.
The question is, if we provide that link to the facebook js library to create the share dialog, when the user posts, does facebook make a copy (where our link expiring 2min later is fine) or does that link have to remain available for longer or forever? If it does make a copy, is that when the user clicks the Post button? Or earlier when the preview is show in the dialog?
Following this link,
Share articles, photos, videos and other content as a URL that points
to the page where your content lives.
It seems facebook don't copy over image, it just keeps a reference.
When you embed a "like this page" button on your page, your profile picture and other people's profile pictures are shown. This requires no authentication, because it's all done through an iframe.
I want to place a placeholder on my site, but I want to spice it up, by adding their profile picture from Facebook instead. Obviously it would have to be in an iframe, because I don't want people to accept terms and stuff like that.
Is this doable? All I have seen requires their user id and so on, which I won't be able to get, as I technically don't handle any of their requests (it's all done client-side because of an iframe). Thanks.
I've been trying to scrape a dynamically updated website, each webpage containing hundreds of rows, and the website in total has thousands of of pages (as in each page is accessed by clicking a "next" button or a number on the bottom of the page, just like you see in the bottom of a Google search page).
While I've been able to successfully scrape the pages, I've had trouble getting 100% accuracy in my results namely because the pages are dynamically updated (javascript). When a user logs in to their account, the system puts them back to the very top of the first row of the first page. So, for example, if I were just about to scrape page 101, and I were on page 100, and a user on page 101 logs in to their account, then I would miss that user's info. Considering the volume of activity, this can be quite problematic.
I tried running my automation during the wee hours, but realized there were users world-wide, so that was a fail. I also can't scrape pages in parallel because the forms are accessed/uploaded through javascript and I've had to use Selenium to click through one page at a time. (There's no unique URL per page; I've also tried looking through my browser's Network tab, but there's no variable that changes when I click on another page). I also tried accessing the API following the instructions on here, but the link that I was able to obtain only displays the information on the current page -- so it's no different than what I was able to access through the HTML source.
What are my options? Is there someway I can catch all the information at once so that I don't risk missing any information?
I know there will be people asking for the URL, but unfortunately I can't give it away. Even if I did, I couldn't give away the username and password. I'm a beginner at web-scraping, so any help is really appreciated!
If you've got no problem hitting the page as many times as you want, and the information never disappears, just go through all the pages as fast as you can, over and over again. In Selenium you can control multiple tabs and/or browsers simultaneously all using the same cookie to make your scraping faster.
Ok so I have no code to show you guys since I have no idea how to even do the code for this but what my client wants is whenever changes or updates are made to a specific page on our website (we use Wordpress), that page's link in the navigational menu will blink.
So basically: page gets updated ==> link in menu blinks ==> link stops blinking when user clicks on page and views it.
There's lots of website change trackers out there but they only do email notifications. My client doesn't want email notifications. He wants the page link to blink in the menu.
Any idea on how to do this? Some sort of jquery or javascript code?
Your two options are a push or pull notification. Using push, you would implement web sockets so the server will push the update flag to the client that will allow the menu link to blink. Using pull, you would have to implement a timer method that periodically checks for updates. When an update is found, it no longer checks until the user clicks the link. There are many ways to implement, but that is the basic concept. Good luck.
Edit: just to clarify the pull method, that will be implemented client-side. A basic JavaScript timer is used and when triggered, you would perform an ajax call to your 'CheckForUpdates' method.
I'd like to be able to tell when the user leaves the site so I can update a field in my database (particularly, a last_visit field in order to determine unread items for each user). However, I'm not sure how to manage the fact that sometimes, a user opens several tabs of the site, so I can't use onbeforeunload reliably to accomplish this goal.
Ideally, I would be able to update this field only when there is only one open tab of the site.
On the hand, maybe I could get more functionality by simply using a table to record read items for several days and assuming that threads older than that are read by default.
What do you think?
Regards
All I can think of is using either cookies or local storage to update the time at which they're viewing your site on each page load. This way, once they close all the tabs where your website is open, the cookie/local storage entry won't update, and you can access that value later on when they return.
So run this every time the page loads:
window.localStorage.setItem('lastVisit',Date.now);
And to grab it:
var lastVisit = window.localStorage.getItem('lastVisit');