This paste expires on 2023-04-16 16:40:09.953946. Repaste, or download this paste. . Pasted through web.

Get YouTube video ID from URL
        """
        try:
            path = info.path
            domain = info.netloc
            video_id = ""
            if domain == "youtu.be" or "/shorts/" in path:
                video_id = path.split("/")[-1]
            else:
                parsed = parse_qsl(info.query)
                params = dict(parsed)
                if "v" in params:
                    video_id = params["v"]
            if video_id:
                return video_id
            else:
                log.error("SpiffyTitles: error getting video id from %s" % (url))
        except IndexError as e:
            log.error(
                "SpiffyTitles: error getting video id from %s (%s)" % (url, str(e))
            )
Filename: how to grab live links?. Size: 758b. View raw, , hex, or download this file.