Wikipedia API - Returning coordinates for some pages and not others? - api

For instance, the following page has the coordinates at the top of the page:
https://en.wikipedia.org/?curid=5839303
and I am able to retrieve them via the API
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=coordinates&pageids=5839303
However this page:
https://en.wikipedia.org/?curid=56846583
Has the coordinates in an infobox and not at the top of the page. I am unable to retrieve them via the API:
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=coordinates&pageids=56846583
Does anyone know why this behaviour occurs and whether it's possible to retrieve the coordinates from my second example via the API?

prop=coordinates, by default, only returns the primary coordinate of the page. Try adding coprimary=all to your query:
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=coordinates&pageids=56846583&coprimary=all

Related

How to get data in dashboard with Scrapy?

I'm scraping some data about car renting from getaround.com. I recently saw that it was possible to get cars availability with scrapy-splash from a calendar rendered with Javascript. An example is given in this url :
https://fr.getaround.com/location-voiture/liege/ford-fiesta-533656
The information I need is contained in the div tag with class owner_calendar_month. However, I saw that some data seem to be accessible in the div tag with class js_car_calendar calendar_large, in which the attribute data-path specify /dashboard/cars/533656/calendar. Do you know how to access this path ? And to scrape the data within it using Scrapy ?
If you visit https://fr.getaround.com/dashboard/cars/533656/calendar you get an error saying you have to be logged in to view the data. So first of all you would have to create a method in Scrapy to sign in to the website if you want to be able to scrape that data.

Get thumbnail from website with Bing Web Search API

Currently I am working on a website that uses google search for searching pages in the domain, google returns a thumbnail from a specific page (Most of the time a random image it finds on the page) together with the search result.
Wanting to move to Bing Web Search API, because google will start adding adds to the result, I was wondering if there was any possibility to get a site's thumbnail together with the search on a specific website? Bing Web Search API Docs says that thumbnails are not supported for all webpages, however there is no clear explanation about how to add one. Is there a workaround for this?
Thanks!
If you are looking for search for your site only, you should use the Bing Custom Search: https://azure.microsoft.com/en-us/services/cognitive-services/bing-custom-search/. You can create your search instance from customsearch.ai. I see custom search returns thumbnails for (al)most (all) results.

Refused to display 'https://cse.google.com/cse?cx=...' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

I have a Google Custom Search result page with iframe fro showing results.
I decide to create new one profile, and use this new in the same context.
So I create profile and all I did on my site - just change search ID.
As a result I got
"Refused to display 'https://cse.google.com/cse?cx=...' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'."
Then I change my ID back to the old one and it's start to work correctly.
Google stop to support iframes for the custom search result. So your old ID's are support iframes, as legacy support but the newly created profiles does not.

Modifying photosphere on website thing

What i am trying to do is to use a photosphere on my website so that it shows up on full screen as a website cover page. The problem is the the code to embed a photosphere in a webpage given here by google
https://developers.google.com/photo-sphere/web/
lets only the photosphere size to be hardcoded as
displaysize="600,400"
what ever the values but its still hardcoded. What i want is that it gets adjusted to the screen of the user and gets displayed in the whole browser window. Any one got an idea how to pull it off? I didn't find any stuff about 'photosphere on web' other than the google link i gave above.
Indeed the API is currently designed to take static values. I think it's a good point that users might want to set the dimensions to 100% and let it resize dynamically.
I put it on the TODO list and will try to get to it shortly.
In the meantime, one work around is the following: After the viewer loads you will find an iframe on the page which contains it. You can change it's dimensions dynamically to your liking and the viewer should adapt.
The API provided by Google wraps the whole photosphere in layers of iFrames.
You can use the API to request a certain photosphere but only use the response to parse it for the values you need. Then you create your own request and the result can be shown fullscreen.
An example link is this
I created this link dynamically from the JSON response from the elements
media$group media$content 0 url
Hope it helps.
Can't you take the raw image and just use webgl to project it on the inside of a sphere?

Google Maps custom marker - can the iframe accept one like the static maps?

I was reading the static maps API, and it says you can include a custom marker in the GET params. You simply link to an image file.
I now have a second Google Map within an iframe, and was wondering if you can attach custom markers via the GET params to it? Here is the src attribute of the iframe currently.
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=111+Fake+Street+Noosaville+Queensland+Australia&ie=UTF8&output=embed
I can't seem to find the documentation on how to do this, if possible.
Is this possible?
As far as I know you cannot add custom marker icons on maps.google.com, but you should be able to add a marker with a custom label.
You may also be interested in checking out the following reference, which describes all the known parameters that can be passed to maps.google.com:
Mapki: Google Map Parameters
While this is not an official API, I think it is fair to say that these should be quite reliable, since they are the same parameters used for the permanent links in Google Maps.
On the other hand, you may want to consider using the Google Maps API instead. You will get all the capabilities you had with the Static Maps API (and more), and it will look pretty much the same as the iframe you are using right now.