I wanted to extract Instagram Follower/Following Data(other user, not my own) and also the names/userid of the Follower/Following. I have searched through the forum but so far what I found is that need authentication before could access any basic data from the Instagram user.
May I know is it possible not to go through the authentication but still able to pull the relationship data (following/follower) data?
What I am trying to achieve here is to track for example do a data analysis of how many followers does a particular public profile of a instagram user has (i.e. maybe some newly opened toy shop that has started a instagram profile). Authenticating each and every single shops that have started a public instagram profile is not feasible. Hence, would there be a way to extract that data using going through the authentication process as described by the API?
Thanks.
My answer is that you need need authentication with some IG account first. After that, the information is all available as long as the account you are looking at is 'public'
API doesn't provide the list of follower anymore even if you are authentificate
You need to do some other technique like the web scraping one (parse the code of the HTML )
This is seriously not my area and the question I was answering to has been closed.
I have spent so long trying to figure this out and although it is a very different solution it's probably going to work for longer.
Open your browser in Mobile mode (no idea how to do).
I have used a python script which did this for me but I will update it with help from the comments
Open a New Tab, acess the profile you want to explore and press followers/following respectively.
Looking at the list of followers/folowing
Inspect any element and go to 'Console' at the top
On the console, paste this and hit Enter.
const arrHtml = document.getElementsByClassName('_ab8w _ab94 _ab99 _ab9f _ab9m _ab9p _abb- _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
And this
const arrHtml = document.getElementsByClassName('_ab8w _ab94 _ab99 _ab9f _ab9m _ab9p _abbj _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
And this
const arrHtml = document.getElementsByClassName('_ab8y _ab94 _ab99 _ab9f _ab9m _ab9p _aba_ _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
And this
const arrHtml = document.getElementsByClassName('_ab8w _ab94 _ab97 _ab9h _ab9k _ab9p _abb0 _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
Now that everything has been stripped away, except for the usernames.
Click anywhere and use Ctrl + A
Copy (Ctrl + C)
And paste (Ctrl + V) wherever you like. enjoy'
Related
I'm making a actions on google project that will use basic functionality of remembering what the user says and using it for another intent.
So for example, this is what the conversation might look like:
1 User: Hello
2 Bot: Hey! What's your name?
3 User: Joel
4 Bot: Your name is Joel, is that correct?
5 User: Yes that is correct
6 Bot: Awesome, it's great to meet you Joel.
I know how to get the information initially, but I am having trouble with getting the information (the name 'Joel') passed to another intent that is used purely for confirmation.
Here is what I have:
app.intent('greeting', (conv, params) => {
const context = conv.contexts.set('context'); // working good
conv.ask(`I got ${params.name}, is that right?`);
});
app.intent('greeting_1', (conv,params) => {
const context1 = conv.contexts.get('context'); //not working
conv.ask(`Awesome, it's great to meet yoy ${params.name}`);
});
If this helps, specifically the error I'm getting reads:
TypeError: Cannot read property 'userDecision' of undefined
How do I get this to work? I have a feeling I have to save the data in userStorage but I've only really had to do that is very basic cases so I'm not to familiar with that.
Thanks for the help!
First of all, hi!
Your initial thought of storing the data in UserStorage might be correct depending on your use case. Let me elaborate:
Two Ways of Saving Data with Actions On Google Node.JS Client Library
Storing Data In A Conversation
You can use conv.data.name = 'Joel' to save the data between the turns of a conversation. But this data won't be available the next time user comes back.
Storing Data Permanently (As Long As The User Allows It)
This is where userStorage comes into play. You can use conv.user.storage.name = 'Joel' to remember the user's name every time they come back. Keep in mind that this type of permanent storage may require consent from the user depending on where they live.
Legal note: Obtaining consent prior to accessing userStorage. Some
countries have regulations that require developers to obtain consent
from the user before they can access, or save certain information
(e.g. personal information) in the userStorage. If you operate in one
of these countries and you want to access, or save such information in
userStorage, you must use the Confirmation helper to ask consent to
the user and obtain the consent before you can start storing such
information in userStorage.
You also need to explain the data you're saving in your Privacy Policy.
As for you specific use case, storing data that won't change (i.e. name) in userStorage is a much better method. Since if you only save it for one conversation, you'll need to ask for permission again the next time.
These should cover your basic needs of saving data on the platform. However, if you do need a more complex state management solution, you may want to check Dialogflow Contexts.
EDIT: I overlooked that you were already using contexts. But the answer still stands, you don't need to use contexts if all you want to do is to save data during a conversation.
But I think the reason you're having a problem is that you're not setting or getting the context parameters correctly. Take a look at the examples here and here:
The context.set() method gets three parameters; name, lifespan and parameters. You're only passing the name of the context in your code.
And, using only contexts.get() method isn't enough to read parameters of a context. You need to read them like this:
app.intent('Tell Greeting', conv => {
const context1 = conv.contexts.get('context1')
const { color, num } = context1.parameters
})
But, I repeat my original point. You shouldn't make things so complicated for yourself if you don't really need to. Try using conv.data and conv.user.storage if possible.
I would like to know if there is any way to check if the user verification badge with the Instagram API?
I have saw that https://api.instagram.com/v1/users/{user-id} doesn't returns if the user is verified, but if you view the source code of a users page, you can see that it has a boolean that called isVerified key and it's value inside a json struct of the user.
Thanks!
Ok, this is not a great answer but here is how I accomplished this same task. Once I have a username from the API I do the following regex on the source of their profile page:
$response = file_get_contents('https://instagram.com/'.$username);
if (preg_match('/"user":\{"username":"'.$username.'",.*?"isVerified":true\},"__path":".*?'.$username.'.*?"/s', $response) || preg_match('/<meta content=".*?official.*?account.*?" name="description" \/>/is', $response)) {
print "VERIFIED USER!";
}
As I said before this is super hacky but the API currently doesn't provide an isVerified value. Until they do I am using this regular expression. It looks for "isVerified":true part of the JSON struct you referenced. (example: https://instagram.com/taylorswift)
We also added an additional check where if the meta content tag has "official account" in it then we assume it's official. (example: https://instagram.com/3doorsdown) We added this check because Instagram started doing verified accounts in 2014 and there are quite a few celebrities that haven't gotten a verified badge yet. It should pick up some of the pieces but could very well bring in false positives too.
NOTE: This solution will break if Instagram ever changes the JSON struct or meta tags on their pages so use at your own risk. We only needed a script to check a small amount of usernames for verified badges and I came up with this real quick. The best solution will be whenever they update their API.
up to a few days ago, when using Graph API search, the results were contextualized to the current user. For example, being logged in with my user so using my access token, calling a search with q=Massimo&type=user returned friends of mine named Massimo, followed by other people called Massimo, but friends of mine were above other results.
Today it just returns random people, the search seems not to be contextualized anymore.
Were there some changes? Are there new search options to get the contextualized results as opposed to generic ones? Was it a policy change for some reason? Or is it simply a side effect or a temporary problem?
TIA
EDIT:
Clarification : the search box inside the Facebook site itself, still returns contextualized content. Previously, a call to the search system via graph api returned more or less the same results, tailored to the user.
Search results are cached by query and not the user searching for something. That means the first time someone searches for something it's cached by facebook. Later, if someone else searches for the same thing, they will get similar results (not always tailored to their account). Privacy settings play a role (e.g. what information is visible and if the user can be searched). but in general, the results will be the same.
You can test this by searching for the same user using two different access tokens. The results will be relatively the same, even if one user is a friend and the other is not.
E.g. Using User A, search for User C (A and C are friends). Check the results.
Then, search for User C, but using User B (B and C are NOT friends). The results should be relatively the same (if not exactly the same.
I want to implement the an auto complete feature in an app am currently developing. I would have used the Blackberry native auto-complete field but I want the auto complete list to be gotten from a web server. This feature is being implemented in the search screen of google maps for blackberry.
Please can u give ideas on how to go about this?
I didn't try but I don't see any issue to do that.
You need to add listener for the EditField - getEditField will help you.
After getting list of suggestions, you pack them to BasicFilteredList and set it to AutoCompleteField with setFilteredList.
You should think also about implementation of case when network is not reachable.
Great example from http://devblog.blackberry.com/2010/04/how-to-use-autocompletefield/
After getting your data back from the web server, store the searchable data as String[].
Then you just need the following code to make your AutoCompleteField work:
BasicFilteredList filterList = new BasicFilteredList();
//my query to sqlite database, yours could just be parsed from your webserver or whatever
String[] list = db.getSearchSuggestions(totalCount);
filterList.addDataSet(1, list, "list", BasicFilteredList.COMPARISON_IGNORE_CASE);
final AutoCompleteField autoComplete = new AutoCompleteField(filterList);
I'm just starting to use sharepoint designer and realised there's a lot that can be done to extend the basic features in sharepoint. We have an email alert sent out when a new task is created (by the user) and I want to customise the email so that it also includes a link called 'Assign'. When clicked, I want this link to automatically update the task with the assigned to field for the person that clicked it.
So I think the way to do this would be to hard-code the assign to value in the url behind this link, but I have no idea if this is possible or if there is an easier/better way to do this.
Any advice would be appreciated as I'm a complete beginner.
thanks.
I will not cover "How to modify the contents of an eamil alert" here as that is a seperate question and there are a lot of articles that cover that already.
For the Assigned link :-
You would need to create a custom page (or web part on an existing page) as the destination of your Assign link - this would take the Task ID as a query string param and then update the assigned to with the current user.
You could make this flexible by also taking the ListID but you may want to think about how this could be abused and put appropriate measures in place.
EDIT - in response to comment.
This is top of my head, not checked in compiler. This would have to sit on the same server as SharePoint to work as its using the OM - if you want to use a different server (why would you though) then look in the web services.
private void updateAssignedTo(Guid listId, int itemID)
{
SPWeb web = SPContent.Current.Web();
SPList list = web.Lists[listId];
SPListItem item = list.GetItemById(itemID);
item["Assigned To"] = web.CurrentUser;
item.Update();
}
You're going to have to work out how to get this code into to page or web part (SharePoint Designer is not going to cut it I think, you need Visual Studio) but its a starting point.