Projects STRLCPY snscrape Commits e7a6d38a
🤬
  • ■ ■ ■ ■ ■ ■
    snscrape/modules/twitter.py
    skipped 382 lines
    383 383   
    384 384   
    385 385  @dataclasses.dataclass
     386 +class UnifiedCardTwitterCommunityDetailsComponentObject(UnifiedCardComponentObject):
     387 + name: str
     388 + theme: str
     389 + membersCount: int
     390 + destinationKey: UnifiedCardDestinationKey
     391 + membersFacepile: typing.Optional[typing.List['User']] = None
     392 + 
     393 + 
     394 +@dataclasses.dataclass
    386 395  class UnifiedCardDestination:
    387 396   url: typing.Optional[str] = None
    388 397   appKey: typing.Optional[UnifiedCardAppKey] = None
    skipped 728 lines
    1117 1126   _logger.warning(f'Unsupported unified_card type on tweet {tweetId}: {unifiedCardType!r}')
    1118 1127   return
    1119 1128   kwargs['type'] = unifiedCardType
    1120  - elif set(c['type'] for c in o['component_objects'].values()) != {'media', 'twitter_list_details'}:
     1129 + elif set(c['type'] for c in o['component_objects'].values()) not in ({'media', 'twitter_list_details'}, {'media', 'community_details'}):
    1121 1130   _logger.warning(f'Unsupported unified_card type on tweet {tweetId}')
    1122 1131   return
    1123 1132   
    skipped 21 lines
    1145 1154   subscriberCount = v['data']['subscriber_count'],
    1146 1155   user = self._user_to_user(o['users'][v['data']['user_id']]),
    1147 1156   destinationKey = v['data']['destination'],
     1157 + )
     1158 + elif v['type'] == 'community_details':
     1159 + co = UnifiedCardTwitterCommunityDetailsComponentObject(
     1160 + name = v['data']['name']['content'],
     1161 + theme = v['data']['theme'],
     1162 + membersCount = v['data']['member_count'],
     1163 + destinationKey = v['data']['destination'],
     1164 + membersFacepile = [self._user_to_user(u) for u in map(o['users'].get, v['data']['members_facepile']) if u],
    1148 1165   )
    1149 1166   else:
    1150 1167   _logger.warning(f'Unsupported unified_card component type on tweet {tweetId}: {v["type"]!r}')
    skipped 538 lines
Please wait...
Page is in error, reload to recover