darkdragn / party

A quick *.party downloader
84 stars 12 forks source link

ValueError: invalid literal for int() with base 10: 'DM524874302416232448' #11

Closed lger42 closed 11 months ago

lger42 commented 11 months ago

Unable to download from specific user shybabybun from fansly. The example "party coomer fansly forgottenlovechild" works though so I don't understand the problem. Trimmed log (it's too long):

PS C:\Users\************> party coomer fansly shybabybun -d "D:\#Party\shybabybun"
2023-07-26 18:55:36.782 | DEBUG    | party.cli:pull_user:74 - Ignored Extensions: []
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\party\cli.py:228 in coomer                     │
│                                                                                                  │
│   225 │   """Convenience command for running against coomer, services[fansly,onlyfans]"""        │
│   226 │   base = "https://coomer.party"                                                          │
│   227 │   # service = "onlyfans"                                                                 │
│ > 228 │   pull_user(                                                                             │
│   229 │   │   service,                                                                           │
│   230 │   │   user_id,                                                                           │
│   231 │   │   base,                                                                              │
│                                                                                                  │
│ ┌─────────────────── locals ───────────────────┐                                                 │
│ │              base = 'https://coomer.party'   │                                                 │
│ │         directory = 'D:\\#Party\\shybabybun' │                                                 │
│ │             files = True                     │                                                 │
│ │ ignore_extensions = []                       │                                                 │
│ │             limit = None                     │                                                 │
│ │              name = None                     │                                                 │
│ │           post_id = False                    │                                                 │
│ │           service = 'fansly'                 │                                                 │
│ │           user_id = 'shybabybun'             │                                                 │
│ │           workers = 2                        │                                                 │
│ └──────────────────────────────────────────────┘                                                 │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\party\cli.py:138 in pull_user                  │
│                                                                                                  │
│   135 │   │   with open(f"{directory}/.embedded", "w", encoding="utf-8") as embed_file:          │
│   136 │   │   │   json.dump(embedded, embed_file)                                                │
│   137 │   with open(f"{directory}/.posts", "w", encoding="utf-8") as posts_file:                 │
│ > 138 │   │   json.dump(posts, posts_file, for_json=True)                                        │
│   139 │   typer.secho(f"Downloading from user: {user.name}", fg=typer.colors.MAGENTA)            │
│   140 │   with tqdm(total=len(files)) as pbar:                                                   │
│   141 │   │   output = asyncio.run(download_async(pbar, base_url, directory, files, workers))    │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\simplejson\__init__.py:269 in dump             │
│                                                                                                  │
│   266 │   │   │   for_json=for_json,                                                             │
│   267 │   │   │   ignore_nan=ignore_nan,                                                         │
│   268 │   │   │   int_as_string_bitcount=int_as_string_bitcount,                                 │
│ > 269 │   │   │   **kw).iterencode(obj)                                                          │
│   270 │   # could accelerate with writelines in some versions of Python, at                      │
│   271 │   # a debuggability cost                                                                 │
│   272 │   for chunk in iterable:                                                                 │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\simplejson\encoder.py:379 in iterencode        │
│                                                                                                  │
│   376 │   │   │   │   self.item_sort_key, self.encoding, self.for_json,                          │
│   377 │   │   │   │   self.iterable_as_array, Decimal=decimal.Decimal)                           │
│   378 │   │   try:                                                                               │
│ > 379 │   │   │   return _iterencode(o, 0)                                                       │
│   380 │   │   finally:                                                                           │
│   381 │   │   │   key_memo.clear()                                                               │
│   382                                                                                            │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\party\posts.py:162 in for_json                 │
│                                                                                                  │
│   159 │                                                                                          │
│   160 │   def for_json(self):                                                                    │
│   161 │   │   """Simplejson export method"""                                                     │
│ > 162 │   │   return PostSchema().dump(self)                                                     │
│   163                                                                                            │
│   164                                                                                            │
│   165 PostSchema = desert.schema_class(                                                          │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\schema.py:549 in dump              │
│                                                                                                  │
│    546 │   │   else:                                                                             │
│    547 │   │   │   processed_obj = obj                                                           │
│    548 │   │                                                                                     │
│ >  549 │   │   result = self._serialize(processed_obj, many=many)                                │
│    550 │   │                                                                                     │
│    551 │   │   if self._has_processors(POST_DUMP):                                               │
│    552 │   │   │   result = self._invoke_dump_processors(                                        │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\schema.py:517 in _serialize        │
│                                                                                                  │
│    514 │   │   │   ]                                                                             │
│    515 │   │   ret = self.dict_class()                                                           │
│    516 │   │   for attr_name, field_obj in self.dump_fields.items():                             │
│ >  517 │   │   │   value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)      │
│    518 │   │   │   if value is missing:                                                          │
│    519 │   │   │   │   continue                                                                  │
│    520 │   │   │   key = field_obj.data_key if field_obj.data_key is not None else attr_name     │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\fields.py:340 in serialize         │
│                                                                                                  │
│    337 │   │   │   │   return value                                                              │
│    338 │   │   else:                                                                             │
│    339 │   │   │   value = None                                                                  │
│ >  340 │   │   return self._serialize(value, attr, obj, **kwargs)                                │
│    341 │                                                                                         │
│    342 │   def deserialize(                                                                      │
│    343 │   │   self,                                                                             │
│                                                                                                  │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\fields.py:643 in _serialize        │
│                                                                                                  │
│    640 │   │   if nested_obj is None:                                                            │
│    641 │   │   │   return None                                                                   │
│    642 │   │   many = schema.many or self.many                                                   │
│ >  643 │   │   return schema.dump(nested_obj, many=many)                                         │
│    644 │                                                                                         │
│    645 │   def _test_collection(self, value):                                                    │
│    646 │   │   many = self.schema.many or self.many                                              │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │       attr = 'attachments'                                                                   │ │
│ │     kwargs = {}                                                                              │ │
│ │       many = True                                                                            │ │
│ │ nested_obj = [                                                                               │ │
│ │              │   Attachment(                                                                 │ │
│ │              │   │   filename='524872891020357632.mp4',                                      │ │
│ │              │   │   name='524872891020357632.mp4',                                          │ │
│ │              │   │                                                                           │ │
│ │              path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.… │ │
│ │              │   │   post_id='DM524874302416232448'                                          │ │
│ │              │   )                                                                           │ │
│ │              ]                                                                               │ │
│ │        obj = Post(                                                                           │ │
│ │              │   added=datetime.datetime(2023, 6, 14, 16, 53, 35),                           │ │
│ │              │   content='a lil video for free !! watch me trying to be quiet while using my │ │
│ │              nora vibrator'+32,                                                              │ │
│ │              │   edited=None,                                                                │ │
│ │              │   id='DM524874302416232448',                                                  │ │
│ │              │   published=datetime.datetime(2023, 6, 13, 5, 29, 5),                         │ │
│ │              │   service='fansly',                                                           │ │
│ │              │   shared_file=False,                                                          │ │
│ │              │   title='DM',                                                                 │ │
│ │              │   user='352820826220802048',                                                  │ │
│ │              │   attachments=[                                                               │ │
│ │              │   │   Attachment(                                                             │ │
│ │              │   │   │   filename='524872891020357632.mp4',                                  │ │
│ │              │   │   │   name='524872891020357632.mp4',                                      │ │
│ │              │   │   │                                                                       │ │
│ │              path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.… │ │
│ │              │   │   │   post_id='DM524874302416232448'                                      │ │
│ │              │   │   )                                                                       │ │
│ │              │   ],                                                                          │ │
│ │              │   embed={},                                                                   │ │
│ │              │   file=Attachment(filename=None, name=None, path=None, post_id=None)          │ │
│ │              )                                                                               │ │
│ │     schema = <Attachment(many=True)>                                                         │ │
│ │       self = <fields.Nested(dump_default=<marshmallow.missing>, attribute=None,              │ │
│ │              validate=None, required=False, load_only=False, dump_only=False,                │ │
│ │              load_default=<marshmallow.missing>, allow_none=False,                           │ │
│ │              error_messages={'required': 'Missing data for required field.', 'null': 'Field  │ │
│ │              may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid       │ │
│ │              type.'})>                                                                       │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\schema.py:549 in dump              │
│                                                                                                  │
│    546 │   │   else:                                                                             │
│    547 │   │   │   processed_obj = obj                                                           │
│    548 │   │                                                                                     │
│ >  549 │   │   result = self._serialize(processed_obj, many=many)                                │
│    550 │   │                                                                                     │
│    551 │   │   if self._has_processors(POST_DUMP):                                               │
│    552 │   │   │   result = self._invoke_dump_processors(                                        │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │          many = True                                                                         │ │
│ │           obj = [                                                                            │ │
│ │                 │   Attachment(                                                              │ │
│ │                 │   │   filename='524872891020357632.mp4',                                   │ │
│ │                 │   │   name='524872891020357632.mp4',                                       │ │
│ │                 │   │                                                                        │ │
│ │                 path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0… │ │
│ │                 │   │   post_id='DM524874302416232448'                                       │ │
│ │                 │   )                                                                        │ │
│ │                 ]                                                                            │ │
│ │ processed_obj = [                                                                            │ │
│ │                 │   Attachment(                                                              │ │
│ │                 │   │   filename='524872891020357632.mp4',                                   │ │
│ │                 │   │   name='524872891020357632.mp4',                                       │ │
│ │                 │   │                                                                        │ │
│ │                 path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0… │ │
│ │                 │   │   post_id='DM524874302416232448'                                       │ │
│ │                 │   )                                                                        │ │
│ │                 ]                                                                            │ │
│ │          self = <Attachment(many=True)>                                                      │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\schema.py:511 in _serialize        │
│                                                                                                  │
│    508 │   │   │   Renamed from ``marshal``.                                                     │
│    509 │   │   """                                                                               │
│    510 │   │   if many and obj is not None:                                                      │
│ >  511 │   │   │   return [                                                                      │
│    512 │   │   │   │   self._serialize(d, many=False)                                            │
│    513 │   │   │   │   for d in typing.cast(typing.Iterable[_T], obj)                            │
│    514 │   │   │   ]                                                                             │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │ many = True                                                                                  │ │
│ │  obj = [                                                                                     │ │
│ │        │   Attachment(                                                                       │ │
│ │        │   │   filename='524872891020357632.mp4',                                            │ │
│ │        │   │   name='524872891020357632.mp4',                                                │ │
│ │        │   │                                                                                 │ │
│ │        path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.mp4',   │ │
│ │        │   │   post_id='DM524874302416232448'                                                │ │
│ │        │   )                                                                                 │ │
│ │        ]                                                                                     │ │
│ │ self = <Attachment(many=True)>                                                               │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\schema.py:512 in <listcomp>        │
│                                                                                                  │
│    509 │   │   """                                                                               │
│    510 │   │   if many and obj is not None:                                                      │
│    511 │   │   │   return [                                                                      │
│ >  512 │   │   │   │   self._serialize(d, many=False)                                            │
│    513 │   │   │   │   for d in typing.cast(typing.Iterable[_T], obj)                            │
│    514 │   │   │   ]                                                                             │
│    515 │   │   ret = self.dict_class()                                                           │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │   .0 = <list_iterator object at 0x000001B2CBE17070>                                          │ │
│ │    d = Attachment(                                                                           │ │
│ │        │   filename='524872891020357632.mp4',                                                │ │
│ │        │   name='524872891020357632.mp4',                                                    │ │
│ │        │                                                                                     │ │
│ │        path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.mp4',   │ │
│ │        │   post_id='DM524874302416232448'                                                    │ │
│ │        )                                                                                     │ │
│ │ self = <Attachment(many=True)>                                                               │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\schema.py:517 in _serialize        │
│                                                                                                  │
│    514 │   │   │   ]                                                                             │
│    515 │   │   ret = self.dict_class()                                                           │
│    516 │   │   for attr_name, field_obj in self.dump_fields.items():                             │
│ >  517 │   │   │   value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)      │
│    518 │   │   │   if value is missing:                                                          │
│    519 │   │   │   │   continue                                                                  │
│    520 │   │   │   key = field_obj.data_key if field_obj.data_key is not None else attr_name     │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │ attr_name = 'post_id'                                                                        │ │
│ │ field_obj = <fields.Integer(dump_default=None, attribute=None, validate=None,                │ │
│ │             required=False, load_only=False, dump_only=False, load_default=None,             │ │
│ │             allow_none=True, error_messages={'required': 'Missing data for required field.', │ │
│ │             'null': 'Field may not be null.', 'validator_failed': 'Invalid value.',          │ │
│ │             'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>           │ │
│ │       key = 'path'                                                                           │ │
│ │      many = False                                                                            │ │
│ │       obj = Attachment(                                                                      │ │
│ │             │   filename='524872891020357632.mp4',                                           │ │
│ │             │   name='524872891020357632.mp4',                                               │ │
│ │             │                                                                                │ │
│ │             path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.m… │ │
│ │             │   post_id='DM524874302416232448'                                               │ │
│ │             )                                                                                │ │
│ │       ret = {                                                                                │ │
│ │             │   'filename': '524872891020357632.mp4',                                        │ │
│ │             │   'name': '524872891020357632.mp4',                                            │ │
│ │             │   'path':                                                                      │ │
│ │             '/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.mp4'    │ │
│ │             }                                                                                │ │
│ │      self = <Attachment(many=True)>                                                          │ │
│ │     value = '/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.mp4'    │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\fields.py:340 in serialize         │
│                                                                                                  │
│    337 │   │   │   │   return value                                                              │
│    338 │   │   else:                                                                             │
│    339 │   │   │   value = None                                                                  │
│ >  340 │   │   return self._serialize(value, attr, obj, **kwargs)                                │
│    341 │                                                                                         │
│    342 │   def deserialize(                                                                      │
│    343 │   │   self,                                                                             │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │ accessor = <bound method Schema.get_attribute of <Attachment(many=True)>>                    │ │
│ │     attr = 'post_id'                                                                         │ │
│ │   kwargs = {}                                                                                │ │
│ │      obj = Attachment(                                                                       │ │
│ │            │   filename='524872891020357632.mp4',                                            │ │
│ │            │   name='524872891020357632.mp4',                                                │ │
│ │            │                                                                                 │ │
│ │            path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.mp… │ │
│ │            │   post_id='DM524874302416232448'                                                │ │
│ │            )                                                                                 │ │
│ │     self = <fields.Integer(dump_default=None, attribute=None, validate=None, required=False, │ │
│ │            load_only=False, dump_only=False, load_default=None, allow_none=True,             │ │
│ │            error_messages={'required': 'Missing data for required field.', 'null': 'Field    │ │
│ │            may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid  │ │
│ │            integer.', 'too_large': 'Number too large.'})>                                    │ │
│ │    value = 'DM524874302416232448'                                                            │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\fields.py:971 in _serialize        │
│                                                                                                  │
│    968 │   │   """Return a string if `self.as_string=True`, otherwise return this field's `num_  │
│    969 │   │   if value is None:                                                                 │
│    970 │   │   │   return None                                                                   │
│ >  971 │   │   ret = self._format_num(value)  # type: _T                                         │
│    972 │   │   return self._to_string(ret) if self.as_string else ret                            │
│    973 │                                                                                         │
│    974 │   def _deserialize(self, value, attr, data, **kwargs) -> _T | None:                     │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │   attr = 'post_id'                                                                           │ │
│ │ kwargs = {}                                                                                  │ │
│ │    obj = Attachment(                                                                         │ │
│ │          │   filename='524872891020357632.mp4',                                              │ │
│ │          │   name='524872891020357632.mp4',                                                  │ │
│ │          │                                                                                   │ │
│ │          path='/be/85/be8541c511a1cad86a98426c473db6b25ee985ff227854128c84e32fa2b5f0db.mp4', │ │
│ │          │   post_id='DM524874302416232448'                                                  │ │
│ │          )                                                                                   │ │
│ │   self = <fields.Integer(dump_default=None, attribute=None, validate=None, required=False,   │ │
│ │          load_only=False, dump_only=False, load_default=None, allow_none=True,               │ │
│ │          error_messages={'required': 'Missing data for required field.', 'null': 'Field may  │ │
│ │          not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid        │ │
│ │          integer.', 'too_large': 'Number too large.'})>                                      │ │
│ │  value = 'DM524874302416232448'                                                              │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\************\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\ │
│ LocalCache\local-packages\Python310\site-packages\marshmallow\fields.py:948 in _format_num       │
│                                                                                                  │
│    945 │                                                                                         │
│    946 │   def _format_num(self, value) -> typing.Any:                                           │
│    947 │   │   """Return the number value for value, given this field's `num_type`."""           │
│ >  948 │   │   return self.num_type(value)                                                       │
│    949 │                                                                                         │
│    950 │   def _validated(self, value) -> _T | None:                                             │
│    951 │   │   """Format the value or raise a :exc:`ValidationError` if an error occurs."""      │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │  self = <fields.Integer(dump_default=None, attribute=None, validate=None, required=False,    │ │
│ │         load_only=False, dump_only=False, load_default=None, allow_none=True,                │ │
│ │         error_messages={'required': 'Missing data for required field.', 'null': 'Field may   │ │
│ │         not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid         │ │
│ │         integer.', 'too_large': 'Number too large.'})>                                       │ │
│ │ value = 'DM524874302416232448'                                                               │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
ValueError: invalid literal for int() with base 10: 'DM524874302416232448'
CodingCoomer commented 11 months ago

@iger42 I've sent a pull request fixing this. Until @darkdragn has time to review/accept the changes, you can change 'Any' to 'str' on lines 38 and 130 of party/posts.py, then re install it ('pip install . ' in the top party/ dir). This fixed the same issue for me (for multiple creators).

CodingCoomer commented 11 months ago

I think this issue an be closed now.