Search code examples
python-3.xipfs

Differentiate between IPFS link and normal link


I have a functionality where I have to differentiate between an IPFS link and a video streaming link. If it is an IPFS link I have to download and save and use that to show video else just show video using streaming link.

     if "https" in url or "http" in url:
            return url 
     else:
            #store and return the stored path

currently I am trying something like this is this valid or is there any better way to achieve this.


Solution

  • If you want to detect HTTP(S) URLs that include IPFS Identifiers (content-addressed), you could re-implement URL detection from JS util: is-ipfs.