InstagramScraper\Model\Media::getCodeFromId PHP Method

getCodeFromId() public static method

public static getCodeFromId ( $id )
    public static function getCodeFromId($id)
    {
        $parts = explode('_', $id);
        $id = $parts[0];
        $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
        $shortenedId = '';
        while ($id > 0) {
            $remainder = $id % 64;
            $id = ($id - $remainder) / 64;
            $shortenedId = $alphabet[$remainder] . $shortenedId;
        }
        return $shortenedId;
    }

Usage Example

示例#1
0
 public static function getMediaCommentsById($mediaId, $count = 10, $maxId = null)
 {
     $code = Media::getCodeFromId($mediaId);
     return self::getMediaCommentsByCode($code, $count, $maxId);
 }
All Usage Examples Of InstagramScraper\Model\Media::getCodeFromId