examples icon indicating copy to clipboard operation
examples copied to clipboard

[BUG: ship_traffic] Access to images on marinetraffic is restricted

Open droumis opened this issue 1 year ago • 2 comments

Cannot get the ship_id as usual from mmsi value (e.g. 369540000):

ship_url = 'https://tinyurl.com/aispage/mmsi:'
headers = {'User-Agent': 'Mozilla/5.0'}
r=requests.get(f'{ship_url}{mmsi}', allow_redirects=True, headers=headers) # r returns 403
ship_id = [el for el in r.url.split('/') if el.startswith('shipid')]

If I manually fetch the ship id manually from the marinetraffic.com website, I cannot get the real image from the current url approach, it's just a placeholder: (https://photos.marinetraffic.com/ais/showphoto.aspx?shipid=4924194&size=thumb300&stamp=false).

image

And if I manually navigate to the correct image on their website (https://images.marinetraffic.com/collection/4924194.webp?size=800), image

... I cannote access it programmatically:

response = requests.get(url, stream=True) # 403

droumis avatar Jun 26 '24 22:06 droumis

I'm not too surprised that marinetraffic.com has changed things around: this was intended to just be a demo and was never a supported API. Looks like you have tried some ideas for workarounds without success...

Maybe there is another online catalog of ships we can get photos for by MMSI?

jlstevens avatar Jun 27 '24 09:06 jlstevens

@jbednar just to make you aware

droumis avatar Jun 28 '24 14:06 droumis