Projects STRLCPY snscrape Commits 21f7b620
🤬
  • moved forward finding out of tgme_widget_message_text clause, since it wasn't correctly getting the forwarding information in forwarded posts that contained attachments but no text

  • Loading...
  • Tristan Lee committed 2 years ago
    21f7b620
    1 parent 9b3faec9
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    snscrape/modules/telegram.py
    skipped 122 lines
    123 123   forwarded = None
    124 124   forwardedUrl = None
    125 125   
     126 + if (forward_tag := post.find('a', class_ = 'tgme_widget_message_forwarded_from_name')):
     127 + forwardedUrl = forward_tag['href']
     128 + forwardedName = forwardedUrl.split('t.me/')[1].split('/')[0]
     129 + forwarded = Channel(username = forwardedName)
     130 + 
    126 131   if (message := post.find('div', class_ = 'tgme_widget_message_text')):
    127 132   content = message.get_text(separator="\n")
    128  - 
    129  - if (forward_tag := post.find('a', class_ = 'tgme_widget_message_forwarded_from_name')):
    130  - forwardedUrl = forward_tag['href']
    131  - forwardedName = forwardedUrl.split('t.me/')[1].split('/')[0]
    132  - forwarded = Channel(username = forwardedName)
    133  - 
    134 133   else:
    135 134   content = None
    136 135   
    skipped 198 lines
Please wait...
Page is in error, reload to recover