UltimaHoarder / UltimaScraper

Scrape all the media from an OnlyFans account - Updated regularly
GNU General Public License v3.0
3.95k stars 606 forks source link

source code string cannot contain null bytes (MacOS 11) #1351

Closed dralfs513 closed 11 months ago

dralfs513 commented 3 years ago

Using the current commit (as of 5 minutes ago) I get the following error after logging in and selecting a model to scrape:

Processing metadata.
Finished processing metadata.
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Traceback (most recent call last):
  File "/Volumes/FourTouch/OnlyFans-master/start_ofd.py", line 45, in main
    api = await main_datascraper.start_datascraper(
  File "/Volumes/FourTouch/OnlyFans-master/datascraper/main_datascraper.py", line 99, in start_datascraper
    names = await main_helper.process_names(
  File "/Volumes/FourTouch/OnlyFans-master/helpers/main_helper.py", line 689, in process_names
    result = await module.start_datascraper(authed, username, site_name)
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 163, in start_datascraper
    results = await prepare_scraper(authed, site_name, item)
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 843, in prepare_scraper
    process_metadata(
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 659, in process_metadata
    Session, api_type, folder = main_helper.export_sqlite(
  File "/Volumes/FourTouch/OnlyFans-master/helpers/main_helper.py", line 305, in export_sqlite
    db_helper.run_migrations(alembic_location, database_path)
  File "/Volumes/FourTouch/OnlyFans-master/helpers/db_helper.py", line 48, in run_migrations
    command.upgrade(alembic_cfg, 'head')
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/command.py", line 294, in upgrade
    script.run_env()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 481, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/compat.py", line 182, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Volumes/FourTouch/OnlyFans-master/database/databases/posts/alembic/env.py", line 80, in <module>
    run_migrations_online()
  File "/Volumes/FourTouch/OnlyFans-master/database/databases/posts/alembic/env.py", line 74, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/runtime/environment.py", line 813, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/runtime/migration.py", line 548, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/command.py", line 283, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 356, in _upgrade_revs
    revs = list(revs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 850, in _iterate_revisions
    uppers = util.dedupe_tuple(self.get_revisions(upper))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 391, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 574, in _resolve_revision_number
    self._revision_map
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/langhelpers.py", line 234, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 155, in _revision_map
    for revision in self._generator():
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 112, in _load_revisions
    script = Script._from_filename(self, vers, file_)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 895, in _from_filename
    module = util.load_python_file(dir_, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/compat.py", line 182, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 851, in exec_module
  File "<frozen importlib._bootstrap_external>", line 988, in get_code
  File "<frozen importlib._bootstrap_external>", line 918, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ValueError: source code string cannot contain null bytes

^CTraceback (most recent call last):
  File "/Volumes/FourTouch/OnlyFans-master/start_ofd.py", line 45, in main
    api = await main_datascraper.start_datascraper(
  File "/Volumes/FourTouch/OnlyFans-master/datascraper/main_datascraper.py", line 99, in start_datascraper
    names = await main_helper.process_names(
  File "/Volumes/FourTouch/OnlyFans-master/helpers/main_helper.py", line 689, in process_names
    result = await module.start_datascraper(authed, username, site_name)
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 163, in start_datascraper
    results = await prepare_scraper(authed, site_name, item)
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 843, in prepare_scraper
    process_metadata(
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 659, in process_metadata
    Session, api_type, folder = main_helper.export_sqlite(
  File "/Volumes/FourTouch/OnlyFans-master/helpers/main_helper.py", line 305, in export_sqlite
    db_helper.run_migrations(alembic_location, database_path)
  File "/Volumes/FourTouch/OnlyFans-master/helpers/db_helper.py", line 48, in run_migrations
    command.upgrade(alembic_cfg, 'head')
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/command.py", line 294, in upgrade
    script.run_env()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 481, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/compat.py", line 182, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Volumes/FourTouch/OnlyFans-master/database/databases/posts/alembic/env.py", line 80, in <module>
    run_migrations_online()
  File "/Volumes/FourTouch/OnlyFans-master/database/databases/posts/alembic/env.py", line 74, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/runtime/environment.py", line 813, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/runtime/migration.py", line 548, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/command.py", line 283, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 356, in _upgrade_revs
    revs = list(revs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 850, in _iterate_revisions
    uppers = util.dedupe_tuple(self.get_revisions(upper))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 391, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 574, in _resolve_revision_number
    self._revision_map
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/langhelpers.py", line 234, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 155, in _revision_map
    for revision in self._generator():
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 112, in _load_revisions
    script = Script._from_filename(self, vers, file_)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 895, in _from_filename
    module = util.load_python_file(dir_, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/compat.py", line 182, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 851, in exec_module
  File "<frozen importlib._bootstrap_external>", line 988, in get_code
  File "<frozen importlib._bootstrap_external>", line 918, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ValueError: source code string cannot contain null bytes

If I press enter it then asks me to select the site to scrape again, repeating the process to ultimately reach the same error.

The headers and avatars files are correctly pulled, and the Posts > Free > Images and Posts > Free > Videos folders are created. There is a not-empty Posts.db in Metadata.

Python 3.9.5 on macOS 11.5 and python 3.9.5 on Raspbian. Selecting a different model or choosing to scrape all does not change anything, wind up at the same error.

UltimaHoarder commented 3 years ago

Try updating the requirements

dralfs513 commented 3 years ago

Upgraded the requirements.txt packages, still get an error though:

INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Traceback (most recent call last):
  File "/Volumes/FourTouch/OnlyFans-master/start_ofd.py", line 62, in <module>
    loop.run_until_complete(main())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Volumes/FourTouch/OnlyFans-master/start_ofd.py", line 46, in main
    api = await main_datascraper.start_datascraper(
  File "/Volumes/FourTouch/OnlyFans-master/datascraper/main_datascraper.py", line 93, in start_datascraper
    await main_helper.process_names(
  File "/Volumes/FourTouch/OnlyFans-master/helpers/main_helper.py", line 807, in process_names
    result = await module.start_datascraper(authed, username, site_name)
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 159, in start_datascraper
    await prepare_scraper(authed, site_name, item)
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 830, in prepare_scraper
    await process_metadata(
  File "/Volumes/FourTouch/OnlyFans-master/modules/onlyfans.py", line 654, in process_metadata
    Session, api_type, folder = main_helper.export_sqlite(
  File "/Volumes/FourTouch/OnlyFans-master/helpers/main_helper.py", line 421, in export_sqlite
    db_helper.run_migrations(alembic_location, database_path)
  File "/Volumes/FourTouch/OnlyFans-master/helpers/db_helper.py", line 48, in run_migrations
    command.upgrade(alembic_cfg, 'head')
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/command.py", line 294, in upgrade
    script.run_env()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 490, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/compat.py", line 184, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Volumes/FourTouch/OnlyFans-master/database/databases/posts/alembic/env.py", line 80, in <module>
    run_migrations_online()
  File "/Volumes/FourTouch/OnlyFans-master/database/databases/posts/alembic/env.py", line 74, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/runtime/environment.py", line 813, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/runtime/migration.py", line 549, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/command.py", line 283, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 365, in _upgrade_revs
    revs = list(revs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 706, in iterate_revisions
    revisions, heads = fn(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 1262, in _collect_upgrade_revisions
    targets = self._parse_upgrade_target(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 1071, in _parse_upgrade_target
    return self.get_revisions(target)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 459, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 661, in _resolve_revision_number
    self._revision_map
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/langhelpers.py", line 234, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/revision.py", line 158, in _revision_map
    for revision in self._generator():
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 115, in _load_revisions
    script = Script._from_filename(self, vers, file_)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/script/base.py", line 904, in _from_filename
    module = util.load_python_file(dir_, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/alembic/util/compat.py", line 184, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 851, in exec_module
  File "<frozen importlib._bootstrap_external>", line 988, in get_code
  File "<frozen importlib._bootstrap_external>", line 918, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ValueError: source code string cannot contain null bytes
UltimaHoarder commented 3 years ago

I made some changes with the database. I dunno if it's been fixed.

dralfs513 commented 3 years ago

That seems to have done it, just tested it with current master and it started scraping content.

Will close this ticket.

dralfs513 commented 3 years ago

Interestingly, I can still get the error with the current release (and with 7.4) if I move the OnlyFans-master directory to an external HDD and try to run from there instead of locally. Not sure why it would error out.

Works fine when run locally so feel free to close, but am happy to keep testing if it is helpful to you.