Check views on Vimeo via API - vimeo

I need to hide video embedding or deactivate the video once it reaches 200 views. Is it possible to check the count of views of a video on Vimeo via API? I can't find this information on the API reference...
I'm trying with this call:
http://vimeo.com/api/v2/video/283030956.json
that video is hidden on vimeo but embedded in a website. When I call the url it returns 283030956 not found.
Is it a problem with the video's privacy?

It looks like the video at https://vimeo.com/283030956 either doesn't exist, or is private. The old Simple API you're using (with the path /api/v2/video/[video_id].json) can only access videos public on Vimeo.
(The Simple API is also deprecated.)
The video's total play count is returned when getting the video's metadata via the full-fledged core API:
curl --location --request GET 'https://api.vimeo.com/videos/[video_id]' \
--header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [auth_token]' \
Documentation is found here:
https://developer.vimeo.com/api/reference/videos#get_video
https://developer.vimeo.com/api/reference/responses/video

Related

Is there a possibility to scrape an entire job offering database?

I am trying to automatically retrieve all active job listings from Deutsche Telekom from the following website: https://telekom.jobs/global-careers
At the moment, there are 1,813 job offerings.
There seems to be an API that returns JSON code (https://telekom.jobs/globaljobboard_api/v3/search/), however the results are limited to 10 (SearchResultCount).
Is there any possibility to parse some parameters to the API so it returns a JSON file with all 1,800 current job offerings?
Thanks
I have tried to add some parameters to the URL, however I was not succesfull with it
https://telekom.jobs/globaljobboard_api/v3/search/%7B%22JobadID%22:%22%22,%22LanguageCode%22:%222%22,%22SearchParameters%22:%7B%22FirstItem%22:1,%22CountItem%22:10000,%22Sort%22:[%7B%22Criterion%22:%22FavoriteJobIndicator%22,%22Direction%22:%22DESC%22%7D],%22MatchedObjectDescriptor%22:[%22ID%22,%22PositionTitle%22,%22ParentOrganization%22,%22ParentOrganizationName%22,%22PositionURI%22,%22PositionLocation.CountryName%22,%22PositionLocation.CountrySubDivisionName%22,%22PositionLocation.CityName%22,%22PositionLocation.Longitude%22,%22PositionLocation.Latitude%22,%22PositionBenefit.Code%22,%22PositionBenefit.Name%22,%22FavoriteJobIndicator%22,%22FavoriteJobIndicatorName%22]%7D,%22SearchCriteria%22:[%7B%22CriterionName%22:%22PositionLocation.Latitude%22,%22CriterionValue%22:[%2250.73743%22]%7D,%7B%22CriterionName%22:%22PositionLocation.Longitude%22,%22CriterionValue%22:[%227.098206800000071%22]%7D,%7B%22CriterionName%22:%22PositionLocation.Distance%22,%22CriterionValue%22:[%229.013064227023515%22]%7D,%7B%22CriterionName%22:%22PositionLocation.CountryCode%22,%22CriterionValue%22:[%22DE%22]%7D,%7B%22CriterionName%22:%22PositionLocation.AreaCode%22,%22CriterionValue%22:[%22DE%22]%7D]
My expected results are a JSON file of the whole database, not only the ten most recent entries.
You need to do a POST with the data {"SearchParameters":{"CountItem":1813}}.
Here an example using curl:
curl 'https://telekom.jobs/globaljobboard_api/v3/search/' -H 'Accept: application/json' --compressed -H 'Content-Type: application/json' --data '{"SearchParameters":{"CountItem":1813}}'
Notice this is particular to this API, this will not necessarily work for others.

webapp2 how to access PUT data

I am using webapp2 to make a small api.
So for example if I have:
import webapp2
class Test(webapp2.RequestHandler):
def put(self):
self.response.write("this was a test")
app = webapp2.WSGIApplication([
('/test', Test)
])
And I do a request through curl:
curl --request PUT --header "Content-Type: application/json" --data '{"content": "test"}' http://localhost:8080/test
How would I go about accessing the data '{"content": "test"}' that was passed in?
All request data would be somewhere in self.request, so in this case take a look at self.request.body to find the request's contents and check out the documentation's Common Request attributes section to see the rest of the options.
You may also want to consider looking at the entire self object in a debugger to find out about more interesting properties it has.

trying to retrieve one object based on conditions values using Android REST API

I’m using Parse.com, and trying to retrieve one object based on conditions values using Android REST API
here is a snippet from the Parse documentation for the REST API
curl -X GET \
-H "X-Parse-Application-Id: MYAPPID" \
-H "X-Parse-REST-API-Key: MYRESTKEY" \
-G \
--data-urlencode 'where={"$relatedTo":{"object":{"__type":"Pointer","className":"Post","objectId":"8TOXdXf3tz"},"key":"likes"}}' \
https://api.parse.com/1/users
How can I achieve this in android?
It's curl based api, you have to explicitly pass all its parameter.
I recommending you to first test api using client application like Postman.
-X define term like GET,POST,PUT,DELETE
-H define header, which has key-value form data separated by ":" sign.
-G When used, all data to be used in an HTTP GET request instead of the POST request that otherwise would be used. The data will be appended to the URL with a '?' separator.
Pass all these parameters and test it, once it is working fine then implement to your application.

Need a little help integrating JAXRSClientFactory with OpenAM RESTful service

I admit I'm a greenhorn with web services.
I am attempting to call an OpenAM restful web service from a legacy unprotected tomEE+ servlet. My problem is that I don't understand what I should be creating for the second argument of:
JAXRSClientFactory.create("http://openam.mylocalAMserver.lan:8080/openam/json/authenticate", WhatClassGoesHere.class);
The OpenAM documentation provides this:
3.3.1. Authentication & Logout
$ curl --request POST --header "X-OpenAM-Username: demo" --header
"X-OpenAM-Password: changeit" --header "Content-Type:
application/json" --data "{}"
https://openam.example.com:8443/openam/json/authenticate
{ "tokenId": "AQIC5w...NTcy*", "successUrl": "/openam/console" }
Should I create a class with instance variables "tokenId", "successURL" and passing that as the second parameter to JAXRSClientFactory? Do I need to worry about all of the parameters specified? Once I figure this out, I've got to figure out how to actually pass the user name and password and invoke the service...
Thanks for your help.
This is really more of a JAXRS question, and is not specific to OpenAM. You need to write Java code to make requests and parse the JSON response. JAXRS is one way to do this- but there are others as well.
Look for a good JAXRS tutorial. The OpenAM part is very simple once you understand REST web services.

Web Scraping, data mining, data extraction

I am tasked with creating a web scraping software, and I don't know where to even begin. Any help would be appreciated, even just telling me how this data is organized, or what "type" of data layout the website is using would help, because I would be able to Google search that term.
http://utilsub.lbs.ubc.ca/ion/default.aspx?dgm=x-pml:/diagrams/ud/Default/7330_FAC-delta_V2.4.1/7330_FAC-delta_V2.4.1-pq.dgm&node=Buildings.Angus_addition&logServerName=QUERYSERVER.UTIL2SUB&logServerHandle=327952
http://utilsub.lbs.ubc.ca/ion/default.aspx?dgm=x-pml:/diagrams/ud/network.dgm&node=Buildings.AERL&unique_id=75660a13-5145-42d5-b661-a50f328306c7&logServerName=QUERYSERVER.UTIL2SUB&logServerHandle=327952
Basically, I need to extract the "harmonic values" from this website. Specifically, I need the 9 numbers displayed on the second link. The numbers are not passed to HTML, they just seem to update automatically every few seconds. I need to able to extract these values in real time as they update. Even if that is not possible I still need to show that doing such web scraping is impossible. I am not given any API's to any of the back end, and do not know how they're site receives the data.
Overall, ANY help would be appreciated, even if its just some simple search terms to put me in the right direction. I am currently clueless in terms of web scraping/data mining/
Web Scraping
To parse HTML from a website is otherwise called Screen Scraping. It’s a process to access external website information (the information must be public – public data) and processing it as required. For instance, if we want to get the average ratings of Nokia Lumia 1020 from different websites we can scrap the ratings from all the websites and calculate the average in our code. So we can say, as a general “User” what you can have as “Public Data”, you’ll be able to scrap that using HTML Agility Pack easily.
Try These :
ASP.NET : HTMLAgilityPack (open source library)
Scraping HTML DOM elements using HtmlAgilityPack (HAP) in ASP.NET
PHP & CURL : WEB SCRAPING WITH PHP & CURL
Node.js : Screen Scraping with Node.js
YQL & Ajax : Screen scraping using YQL and AJAX
Try http://code.google.com/p/crawler4j/
It is very easy to use, you have to override one classe which is Controller.java.
You only need to specify the seeds and it returns the text and the HTML data in two variables for every website crawled.
The second link is pulling information from an API every few seconds. Using Google Chrome you can inspect things like this using the developer tools and clicking on "Network" then. You then see which requests are sent and can easily replicate them by right clicking the request -> copy as CURL. You then get something like this, which includes all headers and post data sent by the request in an CURL command. This is what the second link was calling:
curl 'http://utilsub.lbs.ubc.ca/ion/default.aspx/GetRTxmlData' -H 'Cookie: ASP.NET_SessionId=oq0qiwuqbb3g3453jvyysvjx' -H 'Origin: http://utilsub.lbs.ubc.ca' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Host: utilsub.lbs.ubc.ca' -H 'Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36' -H 'Content-Type: application/json; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: http://utilsub.lbs.ubc.ca/ion/default.aspx?dgm=x-pml:/diagrams/ud/network.dgm&node=Buildings.AERL&unique_id=75660a13-5145-42d5-b661-a50f328306c7&logServerName=QUERYSERVER.UTIL2SUB&logServerHandle=327952' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data-binary $'{\'dgm\':\'x-pml:/diagrams/ud/network.dgm\',\'id\':\'75660a13-5145-42d5-b661-a50f328306c7\',\'node\':\'\'}' --compressed
The API returns XML wrapped in JSON.
You might wanna use CURL with PHP as codeSpy said, you just have to set all the headers and post data and replicate the request properly, otherwise the API wont respond to your request.