lokal-profil / mapillary2commons

Tools and stuff for getting Mapillary content onto Wikimedia Commons
https://tools.wmflabs.org/mapillary-commons
MIT License
6 stars 5 forks source link

Tool broken after Mapillary update #11

Open eneerhut opened 3 years ago

eneerhut commented 3 years ago

Hi there,

We made some platform updates recently and unfortunately they've broken this tool. A minor fix is required to get it working again.

The way image keys work has changed, and so a new URL needs to be used. Mapillary will then convert the old image keys to the new format.

The new url is in the following format: https://www.mapillary.com/app/?&pKey=[ImageKey]

lokal-profil commented 2 years ago

Thanks for the ping. Unfortunately i don't have the bandwidth to patch this right now but am happy to update it if a patch is submitted.

bgo-eiu commented 2 years ago

I had a go at updating it for API v4 https://tools-static.wmflabs.org/mapillary2commons2/

The main difference is that the username isn't provided by the API because Facebook has a blanket rule about this that they've been stuck with apparently. This version embeds the mapillary page with the username in it and has an input to type that in yourself so it gets attributed properly

bgo-eiu commented 2 years ago

I should ask - would you prefer I maintain this separately, or would you like me to submit a pull request? I would like to keep tweaking it so if you wanted to keep it on this page and add me as a contributor that is an option as well. Or, I could just keep it on the separate github project/link. Whatever is easiest for you (assuming this works for everyone).

lokal-profil commented 2 years ago

Great work! I'm happy to add you as a contributor to this repo and a maintainer of the tool. Post a pull request and ping me your Wikimedia user name.

I've updated the url used in the Mapillary-source template to use the v.4 api now. Because that template doesn't yet use the modern translation tool this change is only live for English for now.

lokal-profil commented 2 years ago

@bgo-eiu possibly a later patch but it should be possible to use something like beutifulsoup to extract the username (unless this violates some ToS)

bgo-eiu commented 2 years ago

Alright, I can post a pull request. (Might not have time to get to it today, I intend to make some minor updates to the wording so that it doesn't say it's a fork anymore, and incorporate the accessible tagging suggestions that are recommended in the currently open pull request on this repository.)

My username on the wikimedia toolforge system is middleriverexports (I assume that's the one you would need, they don't allow spaces on there so it's slightly different than Middle river exports which is what I have it set as on other sites).

I was considering using something to scrape the username like that, but when I found out not exposing the username in the API was an intentional decision from Facebook I decided it might not be worth the trouble as I don't know if they would implement something to make scraping them more difficult (for example it used to be possible using the web GL end point to get the username, but they closed off this access point).

One thing that could make things a bit smoother is to automatically fill in the username if it is already included in the URL. I noticed that for example if you start on an image in a sequence like this, you can click on the username and it gets added to the URL parameters:

https://www.mapillary.com/app/?lat=39.28809059491002&lng=-76.59015212306997&z=17&pKey=114064404571320&focus=photo

Which becomes: https://www.mapillary.com/app/user/mapbltmr?lat=39.28809059491002&lng=-76.59015212306997&z=17&pKey=114064404571320&focus=photo

Then if you keep the username panel open and keep moving around in the sequence, the username remains part of the URL, so it could make things slightly smoother if you're in the habit of uploading images one after the other like this.

bgo-eiu commented 2 years ago

Another thing that might be useful down the line is a way to add categories for the image (and structured data) quickly so that it doesn't end up uncategorized on Commons.

Just now I removed the hidden category status from the "Images from Mapillary" category that the template uses, just because it can be helpful to find other Mapillary images without necessarily having hidden categories enabled (and potentially add more detailed categories to ones which don't have other categories).

lokal-profil commented 2 years ago

@bgo-eiu I've added access via https://toolsadmin.wikimedia.org/tools/id/mapillary-commons (which IIRC) should give you become mapillary-commons access when you ssh in

I've also merged the accessibility patch