Open window only for certain countries - localization

For the new gdpr law i am forced to notify the users in europe.
Now i would like to only show this notification to the users in europe.
Whats the best way to do this?
Im using C# and unity3d

Well ... This is almost the solution...
At first, I thought I could use:
System.Globalization.RegionInfo.CurrentRegion
But it turned out that he always displays the "US".
Then I found this plugin:
https://assetstore.unity.com/packages/tools/integration/precise-locale-65836
There libraries for native platforms are used.
PreciseLocale.GetRegion()
It is necessary to compare the received region with:
"BE", "EL", "LT", "PT", "BG", "ES", "LU", "RO", "CZ", "FR", "HU", "SI", "DK", "HR", "MT", "SK", "DE", "IT", "NL", "FI", "EE", "CY", "AT", "SE", "IE", "LV", "PL", "UK", "CH", "NO", "IS", "LI"
Then it remains only to copy the text from the Google's example:
https://developers.google.com/admob/android/eu-consent
and write the code for "npa".
AdRequest request = new AdRequest.Builder() .AddExtra("npa", "1") .Build();
(Sending a value of "1" will serve non-personalized ads)

Related

How to fetch only free videos from YouTube search api(V3)?

I am using YouTube Data's Search API v3 to fetch videos. I am able to fetch videos properly with the below mentioned HTTPS GET request. But this API is listing paid videos too, like the one having the ID FKUvkKsTzV8. That I would like to skip from fetching.
I have gone through the Search API documentation, but was unable to identify the filter for fetching only free videos -- not paid videos.
Please suggest me the filter to fetch only free videos from Search API, if any.
Here is the URL of my HTTPS GET request:
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=5&q=frozen&key=[My api key]&type=video&order=relevance
Edited with more information:
The given video is an example, which will play in some regions only. So adding some more similar to the above mentioned video. I would like to skip these kind of videos from my search result.
https://www.youtube.com/watch?v=ZMWjixQbqXY
https://www.youtube.com/watch?v=Zat88Rsxp94
https://www.youtube.com/watch?v=2YQ9W0BP2Gw
The videos which are free to play is given below
https://www.youtube.com/watch?v=7TavVZMewpY
Looking into the Videos resource meta-data attached to the videos of which ID you mentioned within your question, I deduce that your issue may be reformulated as follows:
Do use the Search.list API endpoint for to search for videos -- using the parameter q as needed --, but exclude from the result set that's provided by the endpoint those videos that are not allowed to be viewed in certain (given) regions.
The Videos resource attached to each video does contain the info that specifies that particular condition above, namely the properties:
contentDetails.regionRestriction (object)
The regionRestriction object contains information about the countries where a video is (or is not) viewable. The object will contain either the contentDetails.regionRestriction.allowed property or the contentDetails.regionRestriction.blocked property.
contentDetails.regionRestriction.allowed[] (list)
A list of region codes that identify countries where the video is viewable. If this property is present and a country is not listed in its value, then the video is blocked from appearing in that country. If this property is present and contains an empty list, the video is blocked in all countries.
contentDetails.regionRestriction.blocked[] (list)
A list of region codes that identify countries where the video is blocked. If this property is present and a country is not listed in its value, then the video is viewable in that country. If this property is present and contains an empty list, the video is viewable in all countries.
Unfortunately, one cannot specify explicitly to the Search.list endpoint a filter based on these properties.
Nevertheless, you may retain as much IDs as you can from Search.list and then query the Videos.list API endpoint for precisely these properties with the purpose of filtering out programatically the videos that are not viewable in the regions of your interest.
The URL that will invoke the Videos.list endpoint would look like:
https://www.googleapis.com/youtube/v3/videos?key=$APP_KEY&id=$VIDEO_IDS&part=contentDetails,id&fields=items(id,contentDetails(regionRestriction))&maxResults=$VIDEO_COUNT
where $APP_KEY is your API key, $VIDEO_IDS is a comma-separated list of video IDs and $VIDEO_COUNT is the number of video IDs that $VIDEO_IDS contains. (Note that $VIDEO_COUNT should not exceed 50.)
Note that the URL above is using the parameter fields for to obtain from the endpoint only the properties that are of actual use. (It's always good to ask from the API only the info that is really needed.)
When setting $VIDEO_COUNT to 5 and $VIDEO_IDS to
FKUvkKsTzV8,ZMWjixQbqXY,Zat88Rsxp94,2YQ9W0BP2Gw,7TavVZMewpY
within the URL above, Videos.list returns the following JSON text:
{
"items": [
{
"id": "FKUvkKsTzV8",
"contentDetails": {
"regionRestriction": {
"allowed": [
"BE",
"NL"
]
}
}
},
{
"id": "ZMWjixQbqXY",
"contentDetails": {
"regionRestriction": {
"allowed": [
"NL"
]
}
}
},
{
"id": "Zat88Rsxp94",
"contentDetails": {
"regionRestriction": {
"allowed": [
"BE",
"NL"
]
}
}
},
{
"id": "2YQ9W0BP2Gw",
"contentDetails": {
"regionRestriction": {
"allowed": [
"PE",
"KG",
"PA",
"PL",
"PH",
"TZ",
"TW",
"TH",
"TJ",
"TM",
"PY",
"KZ",
"GR",
"CY",
"GT",
"CZ",
"CV",
"CR",
"GA",
"CL",
"CO",
"CI",
"SN",
"SI",
"SK",
"SE",
"NP",
"KH",
"NI",
"ID",
"NO",
"NL",
"NA",
"NE",
"PT",
"BZ",
"BY",
"BW",
"BO",
"BJ",
"BF",
"BE",
"ZW",
"MU",
"MT",
"VE",
"EE",
"EC",
"IS",
"MD",
"RW",
"ML",
"AZ",
"ZM",
"LV",
"AR",
"AO",
"AM",
"TG",
"SG",
"DK",
"LT",
"UZ",
"UY",
"DO",
"HU",
"LA",
"HN",
"UG",
"LK",
"UA",
"FI",
"SV"
]
}
}
},
{
"id": "7TavVZMewpY",
"contentDetails": {}
}
]
}
This response indicates that the video identified by FKUvkKsTzV8 is viewable only in NL and BE regions, while the video identified by 7TavVZMewpY has no region restrictions at all (i.e. is freely-viewable everywhere).
Now, it's quite simple to access the properties under the object items[].contantDetails.regionRestriction for to exclude from a filtered result set those video IDs that are not viewable within the regions of your interest.
Addendum
Not sure that what follows will help, but nevertheless, I'll have to mention that the Search.list endpoint does have the following parameter:
regionCode (string)
The regionCode parameter instructs the API to return search results for videos that can be viewed in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code.
The above official specification does not indicate whether regionCode allows one to specify a set of regions, or, otherwise, how to specify to regionCode the set of all regions.

How to know where belongs current IP

I do not know if it is possible to do it, I share a little the case: I need to get the district to which an IP belongs. So I was wondering if there is a way to draw different layers for each district on a map and if the ip is within one of these layers, get the district to which it belongs. Can this be done? Could Openstreet maps help? Or do I have to use google maps
To get the district/region/subdivision from an IP address you will need to use an IP geolocation service. Most include fields such as region and coordinates in their response. However, be aware that not all IP addresses will have this field populated, whatever the geolocation service you use.
Here is a response chunk using Ipregistry:
$ curl https://api.ipregistry.co/144.33.1.2?key=tryout&pretty=true
"location": {
"continent": {
"code": "NA",
"name": "North America"
},
"country": {
"area": 9629091,
"borders": [
"CA",
"MX"
],
"calling_code": "1",
"capital": "Washington D.C.",
"code": "US",
"name": "United States"
},
"region": {
"code": "US-MI",
"name": "Michigan"
},
"city": "Dearborn",
"postal": "48120",
"latitude": 42.31146,
"longitude": -83.19134
}
Once you have the region code or the coordinates you can use both, OpenStreetMap or Google Map to draw what you need.

iTunes search api getting all tracks from result

I am doing a very simple search using iTunes api to try to retrieve a list of podcast of a certain user, the result only shows 1 but the track list is 25. Is there any way to view all “tracks”?
I was able to reproduce the following result using the URL in your comment below:
{
"resultCount": 1,
"results": [
{
"wrapperType": "track",
"kind": "podcast",
"collectionId": 1157898727,
"trackId": 1157898727,
"artistName": "Phoenix FM",
"collectionName": "The West Ham Way on Phoenix FM",
"trackName": "The West Ham Way on Phoenix FM",
"collectionCensoredName": "The West Ham Way on Phoenix FM",
"trackCensoredName": "The West Ham Way on Phoenix FM",
"collectionViewUrl": "https://itunes.apple.com/us/podcast/the-west-ham-way-on-phoenix-fm/id1157898727?mt=2&uo=4",
"feedUrl": "http://feeds.feedburner.com/TheWestHamWayOnPhoenixFm",
"trackViewUrl": "https://itunes.apple.com/us/podcast/the-west-ham-way-on-phoenix-fm/id1157898727?mt=2&uo=4",
"artworkUrl30": "https://is1-ssl.mzstatic.com/image/thumb/Music42/v4/b1/c0/76/b1c076ed-e555-af3b-3f09-5dfc379da0cb/source/30x30bb.jpg",
"artworkUrl60": "https://is1-ssl.mzstatic.com/image/thumb/Music42/v4/b1/c0/76/b1c076ed-e555-af3b-3f09-5dfc379da0cb/source/60x60bb.jpg",
"artworkUrl100": "https://is1-ssl.mzstatic.com/image/thumb/Music42/v4/b1/c0/76/b1c076ed-e555-af3b-3f09-5dfc379da0cb/source/100x100bb.jpg",
"collectionPrice": 0,
"trackPrice": 0,
"trackRentalPrice": 0,
"collectionHdPrice": 0,
"trackHdPrice": 0,
"trackHdRentalPrice": 0,
"releaseDate": "2019-01-23T22:03:00Z",
"collectionExplicitness": "cleaned",
"trackExplicitness": "cleaned",
"trackCount": 25,
"country": "USA",
"currency": "USD",
"primaryGenreName": "Professional",
"contentAdvisoryRating": "Clean",
"artworkUrl600": "https://is1-ssl.mzstatic.com/image/thumb/Music42/v4/b1/c0/76/b1c076ed-e555-af3b-3f09-5dfc379da0cb/source/600x600bb.jpg",
"genreIds": [
"1465",
"26",
"1316"
],
"genres": [
"Professional",
"Podcasts",
"Sports & Recreation"
]
}
]
}
According to this answer by juhariis, you'll need to hit the feedURL (in this case, "http://feeds.feedburner.com/TheWestHamWayOnPhoenixFm") in the result to get access to the actual episodes.
There are probably language or framework-specific packages you to help you out with this.
I hope this helps!
Old Answer
Are you sure your search URL doesn't look like this: https://itunes.apple.com/search?term=firstname+lastname&limit=1?
According to the iTunes Web Service Search API documentation, the limit parameter isn't required in the request URL, so you can simply remove the "&limit=1" part of the query string:
To search for all Jack Johnson audio and video content (movies, podcasts, music, music videos, audiobooks, short films, and tv shows), your URL would look like the following:
https://itunes.apple.com/search?term=jack+johnson

How to get in-app or subscription info from server side?

Is it possbile to get In-app (or subscription) information (at least price, currency) for iOS application by bundle id or product id from server side?
I know that iOS clients possible to do it using their SDK.
Maybe exists service like iTunes Lookup API?
In StoreKit you have SKProduct and there you have the price
You can check it here
https://developer.apple.com/library/ios/documentation/StoreKit/Reference/StoreKit_Collection/
I think the answer is no, they intend you to fetch the IAPs from within the app. Here is an example of what is returned from the iTunes affiliate search API. AFAIK there is no other API to query app information. They don't mention other ways in their guide to obtaining IAP information.
http://itunes.apple.com/lookup?id=828578246
{
"resultCount": 1,
"results": [
{
"isGameCenterEnabled": true,
"screenshotUrls": [
"http://a2.mzstatic.com/us/r30/Purple49/v4/67/01/ff/6701ff5c-55d3-0ea6-d868-8d803072483b/screen696x696.jpeg",
"http://a2.mzstatic.com/us/r30/Purple69/v4/7c/14/5f/7c145fc0-d7af-cfce-eede-f35ad50a779e/screen696x696.jpeg",
"http://a3.mzstatic.com/us/r30/Purple69/v4/cc/0a/43/cc0a4393-a006-f485-a4b5-59049b16da18/screen696x696.jpeg",
"http://a5.mzstatic.com/us/r30/Purple69/v4/e1/76/23/e1762373-849f-9935-7880-34b62365db8c/screen696x696.jpeg",
"http://a5.mzstatic.com/us/r30/Purple69/v4/84/2f/63/842f635e-ccb1-7802-3fc3-020024a8d786/screen696x696.jpeg"
],
"ipadScreenshotUrls": [
"http://a2.mzstatic.com/us/r30/Purple69/v4/26/ea/ca/26eacabe-8606-de7e-c49a-aeb961c44a22/sc1024x768.jpeg",
"http://a4.mzstatic.com/us/r30/Purple49/v4/11/60/5a/11605ad9-c93a-92d2-2abf-faff83c7e5e4/sc1024x768.jpeg",
"http://a4.mzstatic.com/us/r30/Purple69/v4/bb/b5/8e/bbb58e8a-f6fb-7a4d-e6b9-02ad3007d601/sc1024x768.jpeg",
"http://a2.mzstatic.com/us/r30/Purple69/v4/82/d5/34/82d53417-01aa-e6eb-f0f6-c57e76dae3d9/sc1024x768.jpeg",
"http://a4.mzstatic.com/us/r30/Purple49/v4/04/ad/f4/04adf415-1a40-58b6-6d82-6e47394668e4/sc1024x768.jpeg"
],
"appletvScreenshotUrls": [],
"artworkUrl60": "https://is4-ssl.mzstatic.com/image/thumb/Purple71/v4/14/68/e7/1468e7e9-9dc8-4493-2738-bba066cd03c4/source/60x60bb.jpg",
"artworkUrl512": "https://is4-ssl.mzstatic.com/image/thumb/Purple71/v4/14/68/e7/1468e7e9-9dc8-4493-2738-bba066cd03c4/source/512x512bb.jpg",
"artworkUrl100": "https://is4-ssl.mzstatic.com/image/thumb/Purple71/v4/14/68/e7/1468e7e9-9dc8-4493-2738-bba066cd03c4/source/100x100bb.jpg",
"artistViewUrl": "https://itunes.apple.com/us/developer/big-fish-games-inc/id292594310?uo=4",
"kind": "software",
"features": [
"gameCenter",
"iosUniversal"
],
"supportedDevices": [
"iPhone4",
"iPad2Wifi",
"iPad23G",
"iPhone4S",
"iPadThirdGen",
"iPadThirdGen4G",
"iPhone5",
"iPodTouchFifthGen",
"iPadFourthGen",
"iPadFourthGen4G",
"iPadMini",
"iPadMini4G",
"iPhone5c",
"iPhone5s",
"iPhone6",
"iPhone6Plus",
"iPodTouchSixthGen"
],
"advisories": [],
"trackCensoredName": "Gummy Drop!",
"userRatingCountForCurrentVersion": 325,
"sellerUrl": "http://www.bigfishgames.com/mobile-games/ios-games/",
"contentAdvisoryRating": "4+",
"languageCodesISO2A": [
"NL",
"EN",
"FR",
"DE",
"IT",
"JA",
"KO",
"PT",
"RU",
"ES"
],
"fileSizeBytes": "89165452",
"averageUserRatingForCurrentVersion": 4.5,
"trackViewUrl": "https://itunes.apple.com/us/app/gummy-drop!/id828578246?mt=8&uo=4",
"trackContentRating": "4+",
"minimumOsVersion": "7.0",
"formattedPrice": "Free",
"currency": "USD",
"wrapperType": "software",
"version": "2.14.0",
"artistId": 292594310,
"artistName": "Big Fish Games, Inc",
"genres": [
"Games",
"Arcade",
"Puzzle",
"Entertainment"
],
"price": 0,
"description": "Stop crushing & start squishing! Match your way around this candy world! LET’S GO GUMMY! ®\n\nTravel WHEREVER and WHENEVER you want! From Sydney to Tokyo, San Francisco, New York City, Paris, London, Rome, Berlin, New Orleans, Barcelona, Shanghai, Los Angeles, Seoul, Havana, Rio de Janeiro, St. Petersburg, Mexico City, Cape Town, Budapest, Tahiti, Cairo, Marrakesh, Dubai, Bangkok, Athens, Amsterdam, Hawaii, Hong Kong, Singapore, New Delhi, Venice and more coming soon!\n\nFEATURES\n• Play over 10,000 gummified levels across dozens of world cities – MORE levels than any other Match-3 game!\n• Travel to any city, anytime! Earn travel vouchers to unlock the city of your choice.\n• Exciting Achievements! See your accomplishments in your Passport.\n• Unique boosts! Including Shuffle, Lightning, Shovel, and more!\n• Huge rewards! Score in-game items just for playing.\n• Daily Events! Collect sweet bursts of resources and rewards.\n\nREVIEWS\nBetter than Candy Crush (5 STARS)\nLove the way the game travels around the world.\n\nFinally a Straight Up Game Experience (5 STARS)\nThis is an amazing game that is what it says - FREE. You can keep playing a challenging de-stressor without any bait and switch. Love It!!!!!!!!\n\nFun game (5 STARS)\nThis game starts easily and increases in difficulty as you get better. Fun to watch the cities grow as you add details.\n\nCan’t get enough of Gummy Drop! ? Visit our Headquarters, like us on Facebook of follow us on Twitter for sweet musings, matching tips, gummy stories, and tasty giveaways!\n\nGummy Drop! Headquarters: www.bigfishgames.com/gummyHQ \nFacebook: Search Gummy Drop \nTwitter: #GummyDrop \n \n*Note for updates - having trouble seeing your progress after an update? Try connecting with Facebook again and that should do the trick!*",
"trackName": "Gummy Drop!",
"trackId": 828578246,
"bundleId": "com.bigfishgames.worldsagaaapluniversalF2P",
"releaseDate": "2014-09-08T19:29:51Z",
"primaryGenreName": "Games",
"isVppDeviceBasedLicensingEnabled": true,
"currentVersionReleaseDate": "2016-08-23T17:26:54Z",
"releaseNotes": "Join us in the newest city, Queenstown!\nPlay over 360 brand new levels of Gummy matching fun today!\n\nOther improvements:\n•Optimizations and bug fixes to improve overall game performance.\n\nThanks for the continued support and feedback, and be sure to keep an eye out for more exciting updates!\n\nExperiencing issues? Please visit http://bigfi.sh/GummyHQ",
"sellerName": "Big Fish Games, Inc",
"primaryGenreId": 6014,
"genreIds": [
"6014",
"7003",
"7012",
"6016"
],
"averageUserRating": 4.5,
"userRatingCount": 46621
}
]
}
I found a third-party service which allows do this.
Appfigures. In docs they have the type of product inapp. Service may return price and currency. It looks like that I need.
But need to check it in practice.
If somebody know other service which possible to do that, please, share them. Thanks!

Event search returns event outside date range

I have been noticing that sometimes the response to an event search returns an event that is outside of the date range in the que3. Here is an example (with my key removed):
http://www.eventbrite.com/json/event_search?app_key=mykey&keywords=Photography&max=10&latitude=34.19751&longitude=-119.1771&within=50&within_unit=K&date=2012-07-20%202012-07-22
Here are the parameters, one per line:
http://www.eventbrite.com/json/event_search
?app_key=mykey
&keywords=Photography
&max=10
&latitude=34.19751
&longitude=-119.1771
&within=50
&within_unit=K
&date=2012-07-20%202012-07-22
If I run this query, I get 3 events, one of which looks like this (with some items shortened for brevity):
"event": {
"box_header_text_color": "005580",
"link_color": "EE6600",
"box_background_color": "FFFFFF",
"timezone": "US/Pacific",
"box_border_color": "D5D5D3",
"logo": "http://...",
"organizer": {
"url": "http://...,
"id": 1066754373,
"name": "Red Brick Gallery"
},
"background_color": "FFFFFF",
"id": 2667310999,
"category": "seminars,entertainment",
"box_header_background_color": "EFEFEF",
"capacity": 8,
"num_attendee_rows": 9,
"title": "Copy of Watercolor Workshops with Joe Cibere",
"start_date": "2011-07-23 14:00:00",
"status": "Started",
"description": "...",
"end_date": "2012-06-16 17:00:00",
"tags": "...",
"text_color": "005580",
"repeat_schedule": "custom-2659333",
"title_text_color": "", ...
I use the keys (under "event") "start_date" and "end_date" to identify the event dates, which spans from 2011-07-23 to 2012-06-16.
The query spans from 2012-07-20 to 2012-07-22.
The date span of the event and the date span of the query don't overlap.
Am I doing something wrong with my query, or is the response incorrect?
Although this event is scheduled to end on '2012-06-16', it is configured to repeat on various dates in the future. See the "repeats" and "repeat_schedule" attributes for more information.
We recently added support for allowing you to access the array of 'start_date' and 'end_date' pairs (per each repeating instance).
The additional response output should be included any time you add a "display" parameter with a value of "repeat_schedule" to the event_get, event_search, user_list_events, or organizer_list_events API calls.

Resources