Youtube Data API - search should match all keywords - youtube

I'm using the Youtube Data API to search for videos from stage rallying events (auto racing).
The problem is that a lot of the search results don't match all of my keywords. Is there a way to force the API to only return videos that match all of the provided key words?
Here is an example...searching for onboard videos of Rally San Marino 2015:
Rally San Marino 2015 camera|onboard -legend
Notes:
1) There is a different event named "San Marino Rally Legend" which I'm not interested in, therefore I'm excluding all videos from that event using the "-legend" keyword.
2) Italians often use the keyword "Camera Car" in the description/title of onboard videos, therefore I'm searching for camera.
My expectations now would be that it only returns videos which description OR title OR tags contains the following keywords in what ever order: "Rally" AND "San" AND "Marino" AND "2015" AND ("camera" OR "onboard") AND NOT "legend"
However the API returns a lot of videos which do not match that scheme.
The first one is a match:
"43° SAN MARINO RALLY - Camera Car Chardonnet Shakedown - 12/07/2015"|CObJBEALs3Y
But all others do not match:
1) Camera|Onboard didn't match:
"43° rally san marino 2015 - Hightlights only gravel...pure sound (HD)"|_nO-BOT9TWQ
2) Camera|Onboard didn't match:
"Test Andreucci-Andreussi - Rally San Marino 2015"|6AXSUEXLTuY
description: "Test Andreucci-Andreussi - Pre-Rally San Marino 2015 - Peugeot 208 R5."
3) San Marino 2015 didn't match:
"IRC Rally Valli Cuneesi 2016 - Camera Car VINCITORI ASSOLUTI (Chentre - Florean"
description: "Rally Valli Cuneesi 2016 - Camera Car VINCITORI ASSOLUTI (Chentre - Florean) - Rally Video - Camera Car On-board Facebook ..."
Here is the URL that I'm using:
https://www.googleapis.com/youtube/v3/search?part=snippet&key=YOUR-API-KEY&type=video&maxResults=15&videoEmbeddable=true&publishedAfter=2015-01-01T00:00:00Z&q=Rally+san+Marino+2015+camera%7Conboard%20-legend

Related

Geolocation API does not return locality in the response for certain addresses

Google Geolocation API does not return the "locality" field in the response for certain address?
For input, 225 Bush Street San Francisco CA 94104 , the API returns locality field.
For input 12732 W Myrtle Ave, Glendale, AZ 85307, the API does not return locality field. Its getting resolved into a formatted address, which has a city.
When that field will get populated? I looked at the document, it is not clear. Any help will be appreciated.
I read the documentation https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types. It has no detail what type will be set for what address?

Search four fields in YQL geo.places

We are currently using YQL to query geo data for towns and counties in the UK. At the moment, we can use the following query to find all towns named Boston:
select * from geo.places where text="boston" and placeTypeName="Town"
Demo
The issue is, that we would like to specify the county and country to generate more specific results. I have tried the following query, but it returns 0 results:
select * from geo.places where (text="boston" and placeTypeName="Town") and (text="lincolnshire" and placeTypeName="County")
Demo
How can I query 3 field types to return the results I need? Essentially, we would like to query the following fields:
text and placeTypeName="Town"
text and placeTypeName="County"
text and placeTypeName="Country"
This may be an option maybe:
https://developer.yahoo.com/blogs/ydnsevenblog/solving-location-based-services-needs-yahoo-other-technology-7952.html
As it mentions:
Turning text into a location
You can also turn a text (name) into a location using the following code:
yqlgeo.get('paris,fr',function(o){
alert(o.place.name+' ('+
o.place.centroid.latitude+','+
o.place.centroid.longitude+
')');
})
This wrapper call uses our Placemaker Service under the hood and automatically disambiguates for you. This means that Paris is Paris, France, and not Paris Hilton; London is London, England, and not Jack London.

Match nodes of variable depth

I have users who like different geographies (could be a country, state or city) and I want to match those users who like geographies in the same country.
For eg.
user A likes USA
user B likes USA
user C likes San Jose
user D likes France
then I want user A to be matched to users B and C.
What cypher query will get me the results? This is what I tried:
/** node id of user A is 0 **/
START u=node(0) MATCH (u:users) - [:likes] - (g1) - [:contains*0..5] - (g2) - [:likes] - (o:users) RETURN o;
This query is not working as expected. What would be a right syntax?
If I understood you correctly, something like this might work in your case. But pay attention - there might be certain issues in case of circular paths.
The main idea behind this is setting not only relationships but their directions as well.

youtube api - show the most viewd from specific channels

I have a question about the Youtube Api , i'm using the CodeIgniter YouTube API Library by jimdoescode https://github.com/jimdoescode/CodeIgniter-YouTube-API-Library.
Imagine that you have 2 channels , channel x and y .
I need to run a php code which shows me the most viewed videos per week from this tow channels ONLY in (ASC or DESC) order .
** the channels is not yours - it belongs to any user
Ex :
channel x has:
video1 - 3 watchers
video2 - 1 watchers
video3 - 6 watchers
channel y has:
video4 - 9 watchers
video5 - 3 watchers
video6 - 2 watchers
the php code should result the following
video4
video3
video1
video5
video6
video2
I’ve searched on the Youtube api , Developer's Guide, can you help me with some hints please?
I don't believe you can pull feeds from two channels at once from the youtube API.
You would have to pull two feeds and merge the data in PHP and then sort.
As you say you are using the CI Youtube API Library, you would need to add the parameter
orderby with a value of viewCount to the function you are using to pull the feed.
For example, if you are using getUserUploads() you would want something like:
$resultX = $this->youtube->getUserUploads('channelX',array('orderby'=>'viewCount'));
$resultY = $this->youtube->getUserUploads('channelY',array('orderby'=>'viewCount'));
How you parse the XML response results and convert them to an array for sorting I will leave up to you.
http://gdata.youtube.com/feeds/api/users/USERNAME/uploads?orderby=viewCount&max-results=5
Replace USERNAME with the username of the user you want to check for.
Replace 5 with the videos you want to be sorted (shown).

latitude longitude from craigslist

Using YQL and apartment search location from craigslist, I get a result in the following form. Is there any way I can get latitude,longitude information from this ? or do i have to geocode the address ? are there any other source apart from craigslist that can be used to get property details along with geo-location?
{
"about": "http://kolkata.craigslist.co.in/apa/2559284148.html",
"title": [
"Temporary Stay Rental (Kasba Area, Kolkata) 2bd 1100sqft",
"Temporary Stay Rental (Kasba Area, Kolkata) 2bd 1100sqft"
],
"link": "http://kolkata.craigslist.co.in/apa/2559284148.html",
"description": "FURNISHED apartment for executives, professionals, NRIs and visitors for temporary stay in Kolkata (Calcutta).<br>\n<br>\nLOCATION: Kasba area near Delhi Public School - close to Gariahat and EM Bypass<br>\n<br>\n2 bedrooms, 2 bathrooms, a spacious living room, a separate dining room and a modular kitchen. Cooking facility - cooking gas burner, utensils, refrigerator etc. <br>\n<br>\nApartment located at the second floor of a four story building. Elevator available.<br>\n<br>\nHot water, air conditioned bedrooms and one covered parking space available.<br>\n<br>\nRent is INR 2,000.00 (or USD 50.00) per day for a minimum stay of 15 days. Costs of electricity and cooking gas charged separately on actual usage.<br>\n<br>\nShorter stay possible at negotiable rates.<br>\n<br>\nAppropriate ID required for renting.<!-- START CLTAGS -->\n\n\n<br><br><ul class=\"blurbs\">\n<li> <!-- CLTAG GeographicArea=Kasba Area, Kolkata -->Location: Kasba Area, Kolkata\n<li>it's NOT ok to contact this poster with services or other commercial interests</ul>\n<!-- END CLTAGS -->",
"date": "2011-08-22T10:05:43+05:30",
"language": "en-us",
"rights": "Copyright © 2011 craigslist, inc.",
"source": "http://kolkata.craigslist.co.in/apa/2559284148.html",
"type": "text",
"issued": "2011-08-22T10:05:43+05:30"
}
No. You will need to map the regionId's to the coordinates or zipcode.

Resources