Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No preview for a link in Skype #107

Open
eirenik0 opened this issue Feb 27, 2019 · 9 comments
Open

No preview for a link in Skype #107

eirenik0 opened this issue Feb 27, 2019 · 9 comments

Comments

@eirenik0
Copy link

eirenik0 commented Feb 27, 2019

No preview for a link in Skype. When I sent a similar link through the Skype app there is a preview, but not with skpy.

I've found that I can fetch link manually by call getUrlMeta but I have no idea where to past that response.

UPD:
Preview does work with old version of Skype for Web, but not in new one and other versions.

Account type

Live account

Steps to reproduce

    from skpy import Skype
    cli = Skype('username', 'password')
    chat = cli.chats.chat('chat_id')
    # Clickable link but no preview
    chat.sendMsg('<a href="https://github.com">Some link</a>', rich=True)
    # Similar as above
    chat.sendMsg('<a href="https://github.com">https://stackoverflow.com</a>', rich=True)

Result or traceback

Just regular text without link preview.

@Terrance
Copy link
Owner

Weird, one would expect that to be done purely by the client-side receiver (getUrlMeta calls the endpoint Skype for Web uses as a receiving client).

Guess that means the sending client is now expected to include some extra markup on links? What does a link in the raw message look like when sent from the new Skype for Web?

@eirenik0
Copy link
Author

eirenik0 commented Feb 28, 2019

Here is are the HTML of the row:
image

<div role="region" tabindex="-1"
     aria-label="AllatRa отправляет веб-сайт Совместный лайф. Почему сознание не дает записывать влоги?, Какие отговорки придумывает сознание, чтобы не записывать влоги, в которых  человек обличает системы и вскрывает ее основный шаблоны? Почему системе так не выгодно чтобы проливался свет на ее тайно... в 14:19."
     style="position: absolute; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: visible; align-items: stretch; width: 1060px; transform: translateY(3458px);">
    <div role="none"
         style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch;">
        <div role="none"
             style="position: relative; display: flex; flex-direction: row; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch; align-self: stretch; padding-top: 1px; padding-right: 50px;">
            <div role="none"
                 style="position: relative; display: flex; flex-direction: row; flex-grow: 1; flex-shrink: 1; overflow: hidden; align-items: stretch; justify-content: flex-end; padding-left: 206px; transform: translateX(0px);">
                <div role="none"
                     style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: flex-end; opacity: 1;">
                    <button role="button" title="Переслать" aria-label="Переслать" tabindex="-1"
                            style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: center; justify-content: flex-start; background-color: transparent; border-color: transparent; text-align: left; border-width: 0px; padding: 2px 8px 4px 20px; width: 44px; height: 39px; cursor: pointer; border-style: solid;">
                        <div aria-hidden="true" data-text-as-pseudo-element=""
                             style="position: relative; display: inline; flex-grow: 0; flex-shrink: 0; overflow: visible; white-space: pre-wrap; overflow-wrap: break-word; height: 16px; font-size: 16px; color: rgb(138, 141, 145); background-color: rgba(0, 0, 0, 0); font-family: SkypeAssets-Light; padding: 0px; flex-direction: row; align-self: center; align-items: center; justify-content: center; cursor: inherit;"></div>
                    </button>
                </div>
                <div role="none"
                     style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 1; overflow: hidden; align-items: stretch; background-color: rgba(0, 0, 0, 0); min-height: 30px;">
                    <div role="none"
                         style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch;">
                        <div role="none"
                             style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 1; overflow: hidden; align-items: stretch; border-radius: 10px 0px 0px 10px; transform: translateX(0px);">
                            <div role="none"
                                 style="position: relative; display: flex; flex-direction: column; flex-grow: 1; flex-shrink: 1; overflow: hidden; align-items: stretch; --sheep-it:1.84135e+18;">
                                <div role="none"
                                     style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch;">
                                    <div role="none"
                                         style="position: relative; display: flex; flex-direction: column; flex-grow: 1; flex-shrink: 1; overflow: hidden; align-items: stretch; align-self: stretch;">
                                        <button role="button"
                                                title="https://allatra.tv/video/sovmestnyj-life-pochemu-soznanie-ne-daet-zapisyvat-vlogi"
                                                aria-label="AllatRa отправляет веб-сайт Совместный лайф. Почему сознание не дает записывать влоги?, Какие отговорки придумывает сознание, чтобы не записывать влоги, в которых  человек обличает системы и вскрывает ее основный шаблоны? Почему системе так не выгодно чтобы проливался свет на ее тайно... в 14:19."
                                                aria-disabled="false" tabindex="-1"
                                                style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch; justify-content: center; background-color: rgb(241, 241, 244); border-color: rgba(0, 0, 0, 0); text-align: left; border-width: 0px; width: 300px; border-radius: 10px 0px 0px 10px; padding: 0px; cursor: pointer;">
                                            <div role="none"
                                                 style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch; border-width: 0px; border-color: rgba(0, 0, 0, 0);">
                                                <div role="none"
                                                     style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch; border-width: 0px; border-color: rgba(0, 0, 0, 0); width: 300px; height: 150px; background-color: rgb(213, 217, 222); border-top-left-radius: 10px; border-top-right-radius: 10px;">
                                                    <div style="position: relative; overflow: visible; background-color: transparent; flex-grow: 0; flex-shrink: 0; width: 300px; height: 150px; border-top-left-radius: 10px; border-top-right-radius: 10px; background-position: center center; background-repeat: no-repeat; background-image: url(&quot;https://weu1-urlp.secure.skypeassets.com/img1/59e74f0c-678f-422c-81ec-771a9d1fbf2c.jpeg&quot;); background-size: cover; border-style: none; display: flex;"></div>
                                                </div>
                                                <div style="position: relative; display: inline; flex-grow: 0; flex-shrink: 0; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; font-size: 18px; color: rgb(37, 36, 35); font-family: &quot;SF Bold&quot;, &quot;Segoe System UI Bold&quot;, &quot;Segoe UI Bold&quot;, sans-serif; font-weight: 400; margin-top: 10px; line-height: 22px; padding-left: 10px; padding-right: 10px; max-height: 44px; cursor: inherit;">
                                                    Совместный лайф. Почему сознание не дает записывать влоги?
                                                </div>
                                                <div data-text-as-pseudo-element="Какие отговорки придумывает сознание, чтобы не записывать влоги, в которых  человек обличает системы и вскрывает ее основный шаблоны? Почему системе так не выгодно чтобы проливался свет на ее тайно..."
                                                     style="position: relative; display: inline; flex-grow: 0; flex-shrink: 0; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; font-size: 12px; color: rgb(138, 141, 145); font-family: &quot;SF Regular&quot;, &quot;Segoe System UI Regular&quot;, &quot;Segoe UI Regular&quot;, sans-serif; font-weight: 400; margin-top: 4px; padding-left: 10px; padding-right: 10px; line-height: 16px; max-height: 32px; cursor: inherit;"></div>
                                                <div role="none"
                                                     style="position: relative; display: flex; flex-direction: row; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: flex-start; margin-top: 7px; margin-bottom: 12px; padding-left: 12px; padding-right: 12px;">
                                                    <div role="none"
                                                         style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: stretch; height: 16px; width: 16px;">
                                                        <div style="position: relative; overflow: visible; background-color: transparent; flex-grow: 0; flex-shrink: 0; height: 16px; width: 16px; background-position: center center; background-repeat: no-repeat; background-image: url(&quot;https://weu1-urlp.secure.skypeassets.com/img1/b3739ca9-e269-45b5-ab26-0104d8c0ea59.png&quot;); background-size: cover; border-style: none; display: flex;"></div>
                                                    </div>
                                                    <div style="position: relative; display: inline; flex-grow: 1; flex-shrink: 1; overflow: hidden; white-space: pre; text-overflow: ellipsis; font-size: 12px; color: rgb(138, 141, 145); font-family: &quot;SF Regular&quot;, &quot;Segoe System UI Regular&quot;, &quot;Segoe UI Regular&quot;, sans-serif; font-weight: 400; margin-left: 4px; cursor: inherit;">
                                                        https://allatra.tv
                                                    </div>
                                                </div>
                                            </div>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@Terrance
Copy link
Owner

I mean the actual message content, not Skype for Web's rendering of it.

Send a message from new Skype for Web, receive it in SkPy, and check SkypeMsg.content.

@eirenik0
Copy link
Author

eirenik0 commented Mar 1, 2019

Here is a msg content of several msgs:

'\nОсознания людей после фильма СОЗНАНИЕ И ЛИЧНОСТЬ\n#allatra_tv\n\n<a href="https://allatra.tv/video/sovmestnyj-life-pochemu-soznanie-ne-daet-zapisyvat-vlogi">Совместный лайф. Почему сознание не дает записыват
ь влоги?</a>'
'<a href="h
ttps://allatra.tv/video/sovmestnyj-life-pochemu-soznanie-ne-daet-zapisyvat-vlogi">https://allatra.tv/video/sovmestnyj-life-pochemu-soznanie-ne-daet-zapisyvat-vlogi</a>'

You've written that class should be SkypeMsg but I've got SkypeTextMsg. Not sure if this addition is relevant :)

If Cyrillic is bothering you, I could make a post in English :)

@Terrance
Copy link
Owner

Terrance commented Mar 1, 2019

No obvious additional markup then. 😐 If you try sending a message from SkPy and from new Skype for Web, there may be some clues if you compare the raw attributes. That holds the whole server response, so there will be a lot of noise, but maybe it has to declare a link for expanding in there somewhere.

For SkPy, you need to retrieve the message from the server rather than looking at the one you just sent. Easiest way is to send the same link via SkPy and S4W, then retrieve both using SkypeChat.getMsgs().


You've written that class should be SkypeMsg but I've got SkypeTextMsg.

SkypeMsg provides the content attribute; SkypeTextMsg is just a subclass for text-based messages.

@eirenik0
Copy link
Author

eirenik0 commented Mar 2, 2019

Interesting that links that sent from old S4W have no preview in a new one. The content text of SkypeMsg is similar. Where I should looking for text of the message? Should it be in payload? I'm see there only something like this for old skype:

+
�I�JS_default_source©$ec525caa-092f-592d-eceb-09c9077cb879Ñ�äÍ×þ§ZË�
�)$df2227f1-b2d1-3f5d-ad8d-f8140926c336qâÍ×þ§Z©�customÉ��kpi_inapp_activity_startÍ
		+�EventInfo.Source�JS_default_source�EventInfo.InitId$be61185f-c9d6-ec24-ae0e-804700cea14e�EventInfo.Sequence�148�EventInfo.Name�kpi_inapp_activity_start�EventInfo.Time�2019-03-02T19:39:16.209Z�EventInfo.SdkVersion�ACT-Web-JS-2.7.1�AppInfo.Language�en-us�UserInfo.Language�ru�UserInfo.TimeZone�+02:00�DeviceInfo.BrowserName�Firefox�DeviceInfo.BrowserVersion�65.0�DeviceInfo.OsName�Windows�DeviceInfo.OsVersion�10
DeviceInfo.Id$985803d6-2b91-f076-0459-74b54d62ff14�AppInfo.Version�1.125.43�Entry_PointForegrounded�Foreground_Start_Time
1551555556209	GuestFlow�false
session_id$5b774677-f963-43bb-0960-48286c985945�tab_session_id$834212d8-4fb6-4fef-2041-5f29b7eeb7f9�user_agent_name�Firefox�user_agent_version�65
user_agent_OS�Windows�user_agent_OS_version�10�device_type�1screen_width�1536
screen_height�864�cid_hostProperty�SkypePortal
cid_sessionId$49f0f026-e6b1-4d69-0cb5-58865a952fbc	cid_tabId$49f0f026-e6b1-4d69-0cb5-58865a952fbc�api_key	skype.com�locale�en-us
ui_version�908/1.125.0.43//skype.com�version�1.125.43�property	skype.com�Client_Name�Web�etag."Sqrldr0M7kW/C41uoqfJh8QgfF1YpIALtJBjY="�cfg_ids¡�P-R-29040-1-11,P-R-27083-1-8,P-R-23647-1-5,P-R-22489-1-6,P-R-22368-1-6,P-R-22219-1-8,P-R-21836-1-10,P-R-21193-2-15,P-R-21022-1-6,P-R-20676-1-12,P-D-5056-9157-474�browser_notifications_enabled�false	signed_in�1�Skype_InitiatingUser_Username
live:***** �technical_account�1
current_theme�default�	
��user_id0�P�i
live:*****

@Terrance
Copy link
Owner

Terrance commented Mar 3, 2019

I'm not sure what that blob is, where did you get it?

I just tried sending from old and new S4Ws, the payload as seen from old S4W (and therefore from SkPy) appears to be the same:

>>> pprint.pprint(sk.chats['8:fred.2'].getMsgs()[0].raw)
{'clientmessageid': '1551607385077',
 'composetime': '2019-03-03T10:05:21.259Z',
 'content': '<a href="https://medium.com/s/story/why-i-stopped-arguing-politics-on-social-media-f695344d3e3">'
            'https://medium.com/s/story/why-i-stopped-arguing-politics-on-social-media-f695344d3e3</a>',
 'conversationLink': 'https://ch1-client-s.gateway.messenger.live.com/v1/users/ME/conversations/8:fred.2',
 'conversationid': '8:fred.2',
 'from': 'https://ch1-client-s.gateway.messenger.live.com/v1/users/ME/contacts/8:fred.2',
 'id': '1551607521743',
 'messagetype': 'RichText',
 'originalarrivaltime': '2019-03-03T10:05:21.259Z',
 'type': 'Message',
 'version': '1551607521743'}

Given the sending model is completely different in new S4W (sent via an open websocket in a different format), I'm not sure if this is actually fixable using the old endpoint. The fact that links sent from old S4W don't expand either at least confirms it's not a library issue, but one with the API we're using.

@eirenik0
Copy link
Author

eirenik0 commented Mar 3, 2019

How big this task is? Maybe I could implement it

@Terrance
Copy link
Owner

Terrance commented Mar 3, 2019

See notes in #105.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants