Source code for hydrogram.raw.functions.messages.get_web_page_preview
# Hydrogram - Telegram MTProto API Client Library for Python# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>## This file is part of Hydrogram.## Hydrogram is free software: you can redistribute it and/or modify# it under the terms of the GNU Lesser General Public License as published# by the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## Hydrogram is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Lesser General Public License for more details.## You should have received a copy of the GNU Lesser General Public License# along with Hydrogram. If not, see <http://www.gnu.org/licenses/>.fromioimportBytesIOfromhydrogram.raw.core.primitivesimportInt,Long,Int128,Int256,Bool,Bytes,String,Double,Vectorfromhydrogram.raw.coreimportTLObjectfromhydrogramimportrawfromtypingimportList,Optional,Any# # # # # # # # # # # # # # # # # # # # # # # ## !!! WARNING !!! ## This is a generated file! ## All changes made in this file will be lost! ## # # # # # # # # # # # # # # # # # # # # # # #
[docs]classGetWebPagePreview(TLObject):# type: ignore"""Get preview of webpage Details: - Layer: ``181`` - ID: ``8B68B0CC`` Parameters: message (``str``): Message from which to extract the preview entities (List of :obj:`MessageEntity <hydrogram.raw.base.MessageEntity>`, *optional*): Message entities for styled text Returns: :obj:`MessageMedia <hydrogram.raw.base.MessageMedia>` """__slots__:List[str]=["message","entities"]ID=0x8b68b0ccQUALNAME="functions.messages.GetWebPagePreview"def__init__(self,*,message:str,entities:Optional[List["raw.base.MessageEntity"]]=None)->None:self.message=message# stringself.entities=entities# flags.3?Vector<MessageEntity>@staticmethoddefread(b:BytesIO,*args:Any)->"GetWebPagePreview":flags=Int.read(b)message=String.read(b)entities=TLObject.read(b)ifflags&(1<<3)else[]returnGetWebPagePreview(message=message,entities=entities)defwrite(self,*args)->bytes:b=BytesIO()b.write(Int(self.ID,False))flags=0flags|=(1<<3)ifself.entitieselse0b.write(Int(flags))b.write(String(self.message))ifself.entitiesisnotNone:b.write(Vector(self.entities))returnb.getvalue()