Skip to content

Commit

Permalink
add metadata filter
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Nov 16, 2023
1 parent 5cbccdb commit e3d716d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ofscraper/utils/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def create_parser(input=None):
'-af', '--after', help = 'Process post at or after the given date Month/Day/Year\nnWorks for like,unlike, and downloading posts',type=arrow_helper)
post.add_argument(
'-mt', '--mediatype', help = 'Filter by media',default=[],required=False,type = mediatype_helper,action='extend')
post.add_argument(
'-md', '--metadata', help = 'Skip all media downloads and gather metadata only',default=False,action="store_true")

post.add_argument(
'-sx', '--size-max', help = 'Filter out files greater then given size supported inputs include int in bytes or human-readable such as 10mb',required=False,type = parse_size)
Expand Down
5 changes: 5 additions & 0 deletions ofscraper/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def medialist_filter(medialist,model_id,username):

def download_picker(username, model_id, medialist):
medialist=medialist_filter(medialist,model_id,username)
if args_.getargs().metadata:
logging.getLogger("shared").info("skipping all downloads, since metadata is on")
logging.getLogger("shared").error(f'[bold]{username}[/bold] ({0} photos, {0} videos, {0} audios, {0} skipped, {0} failed)' )
return 0,0,0,0,0

if len(medialist)==0:
logging.getLogger("shared").error(f'[bold]{username}[/bold] ({0} photos, {0} videos, {0} audios, {0} skipped, {0} failed)' )
return 0,0,0,0,0
Expand Down

0 comments on commit e3d716d

Please sign in to comment.