notion-py icon indicating copy to clipboard operation
notion-py copied to clipboard

Collection cover url can't be accessed.

Open elblogbruno opened this issue 4 years ago • 2 comments

Hi! Thanks for this awesome repo! I am accessing for my project the cover URL of an array of collections inside a page. If the cover I set is one that comes from the notion, the URL I get is downloadable, but if the image cover is a custom one, I do get the aws link to the image and it can't be accessed. Maybe somehow link needs to be signed with a token for credentials and security purposes or something? Thanks Cordially, Bruno

elblogbruno avatar May 02 '21 14:05 elblogbruno

Update: Found something

cover = collection.cover

cover = urllib.parse.quote(cover)
cover = cover.replace("/","%2F")
url = "https://www.notion.so/image/{0}?table=collection&id={1}&width=300&userId={2}&cache=v2".format(cover,collection_id, self.client.current_user.id)

Will help you access the image. The width parameter can be changed to whatever you want I have been seeing! Hope this helps someone.

elblogbruno avatar May 02 '21 14:05 elblogbruno

+1

kaedea avatar May 15 '21 18:05 kaedea