@ -29,6 +29,7 @@ class MastodonExtractor(BaseExtractor):
self . instance = self . root . partition ( " :// " ) [ 2 ]
self . instance = self . root . partition ( " :// " ) [ 2 ]
self . reblogs = self . config ( " reblogs " , False )
self . reblogs = self . config ( " reblogs " , False )
self . replies = self . config ( " replies " , True )
self . replies = self . config ( " replies " , True )
self . cards = self . config ( " cards " , False )
def items ( self ) :
def items ( self ) :
for status in self . statuses ( ) :
for status in self . statuses ( ) :
@ -48,6 +49,17 @@ class MastodonExtractor(BaseExtractor):
if status [ " reblog " ] :
if status [ " reblog " ] :
attachments . extend ( status [ " reblog " ] [ " media_attachments " ] )
attachments . extend ( status [ " reblog " ] [ " media_attachments " ] )
if self . cards :
card = status . get ( " card " )
if card :
url = card . get ( " image " )
if url :
card [ " weburl " ] = card . get ( " url " )
card [ " url " ] = url
card [ " id " ] = " card " + " " . join (
url . split ( " / " ) [ 6 : - 2 ] ) . lstrip ( " 0 " )
attachments . append ( card )
status [ " instance " ] = self . instance
status [ " instance " ] = self . instance
acct = status [ " account " ] [ " acct " ]
acct = status [ " account " ] [ " acct " ]
status [ " instance_remote " ] = \
status [ " instance_remote " ] = \
@ -120,6 +132,7 @@ class MastodonUserExtractor(MastodonExtractor):
api . account_id_by_username ( self . item ) ,
api . account_id_by_username ( self . item ) ,
only_media = (
only_media = (
not self . reblogs and
not self . reblogs and
not self . cards and
not self . config ( " text-posts " , False )
not self . config ( " text-posts " , False )
) ,
) ,
exclude_replies = not self . replies ,
exclude_replies = not self . replies ,